generated from liutk/owl-admin-base
编码风格
parent
7efc12327e
commit
970cef0c32
|
|
@ -6,8 +6,8 @@ use App\Models\Keyword;
|
|||
use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
|
||||
use Slowlyo\OwlAdmin\Renderers\WangEditor;
|
||||
|
||||
class Components extends BaseRenderer {
|
||||
|
||||
class Components extends BaseRenderer
|
||||
{
|
||||
/**
|
||||
* 父级选择器
|
||||
*/
|
||||
|
|
@ -23,7 +23,8 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 排序字段
|
||||
*/
|
||||
public function sortControl($name ='sort', $label = null){
|
||||
public function sortControl($name = 'sort', $label = null)
|
||||
{
|
||||
return amisMake()->NumberControl()
|
||||
->name($name)->label($label ?? __('admin.components.order'))
|
||||
->displayMode('enhance')
|
||||
|
|
@ -34,7 +35,8 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 2位小数输入框
|
||||
*/
|
||||
public function decimalControl($name ='decimal', $label = null){
|
||||
public function decimalControl($name = 'decimal', $label = null)
|
||||
{
|
||||
return amisMake()->NumberControl()
|
||||
->name($name)->label($label ?? __('admin.components.decimal'))
|
||||
->kilobitSeparator(true)
|
||||
|
|
@ -58,7 +60,8 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 开关
|
||||
*/
|
||||
public function enableControl($name = 'is_enable', $label= null, $mode = 'horizontal'){
|
||||
public function enableControl($name = 'is_enable', $label = null, $mode = 'horizontal')
|
||||
{
|
||||
return amisMake()->SwitchControl()
|
||||
->name($name)->label($label ?? __('admin.components.status'))
|
||||
->mode($mode)
|
||||
|
|
@ -68,7 +71,8 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 图片上传
|
||||
*/
|
||||
public function imageControl($name, $label){
|
||||
public function imageControl($name, $label)
|
||||
{
|
||||
return amis()->ImageControl($name, $label)
|
||||
->joinValues(false)
|
||||
->autoUpload(true)->maxSize('5*1024*1024'); //不能大于5M
|
||||
|
|
@ -77,21 +81,24 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 图片上传,带裁剪
|
||||
*/
|
||||
public function cropImageControl($name, $label, $aspectRatio = null){
|
||||
public function cropImageControl($name, $label, $aspectRatio = null)
|
||||
{
|
||||
$cropImage = amis()->ImageControl($name, $label)->joinValues(false);
|
||||
// if($aspectRatio){
|
||||
$cropImage->crop([
|
||||
'aspectRatio' => $aspectRatio ?? 1
|
||||
'aspectRatio' => $aspectRatio ?? 1,
|
||||
]);
|
||||
// }
|
||||
$cropImage->autoUpload(true);
|
||||
|
||||
return $cropImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通文件上传
|
||||
*/
|
||||
public function fileControl($name, $label, $accept = '.txt', $multiple = false){
|
||||
public function fileControl($name, $label, $accept = '.txt', $multiple = false)
|
||||
{
|
||||
return amis()->FileControl($name, $label ?? __('admin.components.files'))
|
||||
->multiple($multiple)
|
||||
->joinValues(false)
|
||||
|
|
@ -100,7 +107,8 @@ class Components extends BaseRenderer {
|
|||
->accept($accept);
|
||||
}
|
||||
|
||||
public function chunkFileControl($name, $label, $accept = '*', $multiple = false){
|
||||
public function chunkFileControl($name, $label, $accept = '*', $multiple = false)
|
||||
{
|
||||
return amis()->FileControl($name, $label ?? __('admin.components.files'))
|
||||
->multiple($multiple)
|
||||
->joinValues(false)
|
||||
|
|
@ -114,25 +122,28 @@ class Components extends BaseRenderer {
|
|||
/**
|
||||
* 标签选择
|
||||
*/
|
||||
public function keywordsTagControl($name = 'tags', $label= null, $pKey = null){
|
||||
public function keywordsTagControl($name = 'tags', $label = null, $pKey = null)
|
||||
{
|
||||
return amisMake()->TagControl()
|
||||
->name($name)->label($label ?? __('admin.components.tag'))
|
||||
->maxTagLength(0)
|
||||
->options(Keyword::where('parent_key', $pKey)->pluck('name', 'id')->toArray());
|
||||
}
|
||||
|
||||
public function keywordsTag($label = null, $color = null){
|
||||
public function keywordsTag($label = null, $color = null)
|
||||
{
|
||||
if ($color) {
|
||||
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
|
||||
->displayMode('rounded')->style([
|
||||
'color' => '#fff',
|
||||
'backgroundColor' => $color,
|
||||
'borderColor' => $color
|
||||
'borderColor' => $color,
|
||||
]);
|
||||
} else {
|
||||
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
|
||||
->displayMode('rounded')->color('inactive');
|
||||
}
|
||||
|
||||
return $tag;
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +151,8 @@ class Components extends BaseRenderer {
|
|||
* 生成统计图config
|
||||
* 折线图或者柱状图
|
||||
*/
|
||||
public function chartLineBarConfig($title = null, array $x , array $y){
|
||||
public function chartLineBarConfig($title, array $x, array $y)
|
||||
{
|
||||
$yAxisData = [];
|
||||
$seriesData = [];
|
||||
$color = [];
|
||||
|
|
@ -164,12 +176,12 @@ class Components extends BaseRenderer {
|
|||
'axisLine' => [
|
||||
'show' => true,
|
||||
'lineStyle' => [
|
||||
'color' => $item['color'] ?? ''
|
||||
]
|
||||
'color' => $item['color'] ?? '',
|
||||
],
|
||||
],
|
||||
'axisLabel' => [
|
||||
'formatter'=>'{value} '
|
||||
]
|
||||
'formatter' => '{value} ',
|
||||
],
|
||||
];
|
||||
//数据
|
||||
$_series = [
|
||||
|
|
@ -184,10 +196,10 @@ class Components extends BaseRenderer {
|
|||
'smooth' => true,
|
||||
'symbol' => 'none',
|
||||
'lineStyle' => [
|
||||
'color' => $item['color'] ?? ''
|
||||
'color' => $item['color'] ?? '',
|
||||
],
|
||||
'areaStyle' => [
|
||||
'color' => $item['color'] ?? ''
|
||||
'color' => $item['color'] ?? '',
|
||||
],
|
||||
]);
|
||||
break;
|
||||
|
|
@ -205,10 +217,10 @@ class Components extends BaseRenderer {
|
|||
'title' => [
|
||||
'text' => $title,
|
||||
],
|
||||
"tooltip" => [//提示
|
||||
'tooltip' => [//提示
|
||||
'trigger' => 'axis', //坐标轴触发
|
||||
'axisPointer' => [
|
||||
'type' => 'cross'
|
||||
'type' => 'cross',
|
||||
],
|
||||
// 'formatter' => $tips
|
||||
],
|
||||
|
|
@ -221,14 +233,15 @@ class Components extends BaseRenderer {
|
|||
'data' => $x,
|
||||
],
|
||||
'yAxis' => $yAxisData,
|
||||
'series' => $seriesData
|
||||
'series' => $seriesData,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 散点图
|
||||
*/
|
||||
public function chartScatterConfig($title = null, array $x , array $y, array $yData = null){
|
||||
public function chartScatterConfig($title, array $x, array $y, ?array $yData = null)
|
||||
{
|
||||
$yAxisData = [];
|
||||
$seriesData = [];
|
||||
$color = [];
|
||||
|
|
@ -243,9 +256,9 @@ class Components extends BaseRenderer {
|
|||
// ]
|
||||
// ],
|
||||
'axisTick' => [
|
||||
'alignWithLabel'=>true
|
||||
'alignWithLabel' => true,
|
||||
],
|
||||
'data'=> $yData
|
||||
'data' => $yData,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -256,10 +269,10 @@ class Components extends BaseRenderer {
|
|||
'title' => [
|
||||
'text' => $title,
|
||||
],
|
||||
"tooltip" => [//提示
|
||||
'tooltip' => [//提示
|
||||
'trigger' => 'axis', //坐标轴触发
|
||||
'axisPointer' => [
|
||||
'type' => 'cross'
|
||||
'type' => 'cross',
|
||||
],
|
||||
],
|
||||
'xAxis' => [
|
||||
|
|
@ -267,7 +280,7 @@ class Components extends BaseRenderer {
|
|||
'data' => $x,
|
||||
],
|
||||
'yAxis' => $yAxisData,
|
||||
'series' => $seriesData
|
||||
'series' => $seriesData,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +288,8 @@ class Components extends BaseRenderer {
|
|||
* 生成饼状图config
|
||||
* -todo
|
||||
*/
|
||||
public function chartPieConfig(){
|
||||
return ;
|
||||
public function chartPieConfig()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ class AdController extends AdminController
|
|||
Components::make()->parentControl(admin_url('api/keywords/tree-list?parent_name=banner_address&has_owner=0'), 'address', __('admin.ads.address'), 'name', 'key'),
|
||||
amis()->SelectControl('enable', __('admin.ads.is_enable'))
|
||||
->options([
|
||||
1=>'开启',0=>'关闭'
|
||||
1 => '开启', 0 => '关闭',
|
||||
]),
|
||||
]),
|
||||
amis()->GroupControl()->mode('horizontal')->body([
|
||||
|
|
@ -61,7 +61,7 @@ class AdController extends AdminController
|
|||
Operation::make()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditButton(),
|
||||
$this->rowDeleteButton(),
|
||||
])
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
|
|
@ -91,7 +91,7 @@ class AdController extends AdminController
|
|||
return $this->baseDetail()->body([
|
||||
amis()->TextControl('id', 'ID')->static(),
|
||||
amis()->TextControl('created_at', __('admin.created_at'))->static(),
|
||||
amis()->TextControl('updated_at', __('admin.updated_at'))->static()
|
||||
amis()->TextControl('updated_at', __('admin.updated_at'))->static(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminRoleController as AdminRoleBaseController;
|
||||
use Slowlyo\OwlAdmin\Renderers\Page;
|
||||
|
||||
class AdminRoleController extends AdminRoleBaseController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class AdminUserController extends AdminController
|
|||
amisMake()->Form()->title('')
|
||||
->api([
|
||||
'method' => 'PUT',
|
||||
'url'=> admin_url('system/admin_users/$id')
|
||||
'url' => admin_url('system/admin_users/$id'),
|
||||
])
|
||||
->body([
|
||||
amisMake()->TextControl('id')->value('${id}')->hidden(true),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ namespace App\Admin\Controllers;
|
|||
|
||||
use App\Admin\Components;
|
||||
use App\Admin\Services\ArticleService;
|
||||
use App\Casts\Storage;
|
||||
use App\Models\Keyword;
|
||||
use App\Traits\CustomActionTrait;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
|
|
@ -15,6 +14,7 @@ use Slowlyo\OwlAdmin\Renderers\Page;
|
|||
class ArticleController extends AdminController
|
||||
{
|
||||
use CustomActionTrait;
|
||||
|
||||
protected string $serviceName = ArticleService::class;
|
||||
|
||||
public function list(): Page
|
||||
|
|
@ -37,12 +37,12 @@ class ArticleController extends AdminController
|
|||
amis()->SelectControl('enable', __('admin.articles.is_enable'))
|
||||
->columnRatio(3)
|
||||
->options([
|
||||
1=>'开启',0=>'关闭'
|
||||
1 => '开启', 0 => '关闭',
|
||||
]),
|
||||
amis()->SelectControl('recommend', __('admin.articles.is_recommend'))
|
||||
->columnRatio(3)
|
||||
->options([
|
||||
1=>'开启',0=>'关闭'
|
||||
1 => '开启', 0 => '关闭',
|
||||
]),
|
||||
amis()->InputDatetimeRange()->label(__('admin.articles.published_at'))->name('published_at'),
|
||||
]),
|
||||
|
|
@ -56,7 +56,7 @@ class ArticleController extends AdminController
|
|||
'position' => 'top-left',
|
||||
'badgeLevel' => 'danger',
|
||||
'visibleOn' => '${is_recommend > 0}',
|
||||
'size' => 15
|
||||
'size' => 15,
|
||||
])
|
||||
->columns([
|
||||
amis()->TableColumn('id', __('admin.id'))->sortable(true),
|
||||
|
|
@ -73,7 +73,7 @@ class ArticleController extends AdminController
|
|||
amis()->Operation()->label(__('admin.actions'))->buttons([
|
||||
$this->rowEditTypeButton('drawer', 'xl'),
|
||||
$this->rowDeleteButton(),
|
||||
])
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
|
|
@ -96,7 +96,7 @@ class ArticleController extends AdminController
|
|||
])->md(4),
|
||||
amis()->Wrapper()->body([
|
||||
Components::make()->fuEditorControl('content', __('admin.articles.content')),
|
||||
])->md(8)
|
||||
])->md(8),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
|
@ -105,5 +105,4 @@ class ArticleController extends AdminController
|
|||
{
|
||||
return $this->baseDetail()->body([]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Slowlyo\OwlAdmin\Controllers\AuthController as AdminAuthController;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Slowlyo\OwlAdmin\Controllers\AuthController as AdminAuthController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class AuthController extends AdminAuthController
|
||||
{
|
||||
|
|
@ -46,6 +46,7 @@ class AuthController extends AdminAuthController
|
|||
$module = Admin::currentModule(true);
|
||||
$prefix = $module ? $module.'.' : '';
|
||||
$token = $user->createToken($prefix.'admin')->plainTextToken;
|
||||
|
||||
return $this->response()->success(compact('token'), __('admin.login_successful'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
namespace App\Admin\Controllers;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Slowlyo\OwlAdmin\Renderers\Card;
|
||||
use Slowlyo\OwlAdmin\Renderers\Flex;
|
||||
use Slowlyo\OwlAdmin\Renderers\Html;
|
||||
use Slowlyo\OwlAdmin\Renderers\Grid;
|
||||
use Slowlyo\OwlAdmin\Renderers\Chart;
|
||||
use Slowlyo\OwlAdmin\Renderers\Image;
|
||||
use Slowlyo\OwlAdmin\Renderers\Action;
|
||||
use Slowlyo\OwlAdmin\Renderers\Custom;
|
||||
use Slowlyo\OwlAdmin\Renderers\Wrapper;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use Slowlyo\OwlAdmin\Renderers\Action;
|
||||
use Slowlyo\OwlAdmin\Renderers\Card;
|
||||
use Slowlyo\OwlAdmin\Renderers\Chart;
|
||||
use Slowlyo\OwlAdmin\Renderers\Custom;
|
||||
use Slowlyo\OwlAdmin\Renderers\Flex;
|
||||
use Slowlyo\OwlAdmin\Renderers\Grid;
|
||||
use Slowlyo\OwlAdmin\Renderers\Html;
|
||||
use Slowlyo\OwlAdmin\Renderers\Image;
|
||||
use Slowlyo\OwlAdmin\Renderers\Wrapper;
|
||||
|
||||
class HomeController extends AdminController
|
||||
{
|
||||
|
|
@ -47,7 +47,7 @@ class HomeController extends AdminController
|
|||
return Card::make()
|
||||
->className('h-full clear-card-mb')
|
||||
->body(
|
||||
Custom::make()->html(<<<HTML
|
||||
Custom::make()->html(<<<'HTML'
|
||||
<div class="h-full flex flex-col mt-5 py-5 px-7">
|
||||
<div>『</div>
|
||||
<div class="flex flex-1 items-center w-full justify-center" id="hitokoto">
|
||||
|
|
@ -64,12 +64,12 @@ class HomeController extends AdminController
|
|||
</div>
|
||||
HTML
|
||||
|
||||
)->onMount(<<<JS
|
||||
)->onMount(<<<'JS'
|
||||
fetch('https://v1.hitokoto.cn?c=i')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const hitokoto = document.querySelector('#hitokoto_text')
|
||||
hitokoto.href = `https://hitokoto.cn/?uuid=\${data.uuid}`
|
||||
hitokoto.href = `https://hitokoto.cn/?uuid=${data.uuid}`
|
||||
hitokoto.innerText = data.hitokoto
|
||||
document.querySelector('#hitokoto_from_who').innerText = data.from_who
|
||||
document.querySelector('#hitokoto_from').innerText = data.from
|
||||
|
|
@ -88,7 +88,7 @@ JS
|
|||
Custom::make()
|
||||
->name('clock')
|
||||
->html('<div id="clock" class="text-4xl"></div><div id="clock-date" class="mt-5"></div>')
|
||||
->onMount(<<<JS
|
||||
->onMount(<<<'JS'
|
||||
const clock = document.getElementById('clock');
|
||||
const tick = () => {
|
||||
clock.innerHTML = (new Date()).toLocaleTimeString();
|
||||
|
|
@ -176,6 +176,7 @@ JS
|
|||
for ($i = 0; $i < 7; $i++) {
|
||||
$_arr[] = random_int(10, 200);
|
||||
}
|
||||
|
||||
return '['.implode(',', $_arr).']';
|
||||
};
|
||||
|
||||
|
|
@ -201,7 +202,7 @@ series: [
|
|||
public function cube(): Card
|
||||
{
|
||||
return Card::make()->className('h-96 ml-4 w-8/12')->body(
|
||||
Html::make()->html(<<<HTML
|
||||
Html::make()->html(<<<'HTML'
|
||||
<style>
|
||||
.cube-box{ height: 300px; display: flex; align-items: center; justify-content: center; }
|
||||
.cube { width: 100px; height: 100px; position: relative; transform-style: preserve-3d; animation: rotate 10s linear infinite; }
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use App\Traits\UploadTrait;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
|
||||
class IndexController extends AdminController
|
||||
{
|
||||
use UploadTrait;
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ class KeywordController extends AdminController
|
|||
->placeholder(__('admin.keywords.search_name')),
|
||||
amis()->TextControl('parent_name', __('admin.keywords.parent_keyword'))
|
||||
->size('md')
|
||||
->placeholder(__('admin.keywords.search_name'))
|
||||
->placeholder(__('admin.keywords.search_name')),
|
||||
]
|
||||
))
|
||||
->columns([
|
||||
|
|
@ -63,7 +63,8 @@ class KeywordController extends AdminController
|
|||
]);
|
||||
}
|
||||
|
||||
public function getTreeList(Request $request){
|
||||
public function getTreeList(Request $request)
|
||||
{
|
||||
return $this->service->getTree();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,11 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
use Slowlyo\OwlAdmin\Renderers\Tab;
|
||||
use Slowlyo\OwlAdmin\Renderers\Tabs;
|
||||
use Slowlyo\OwlAdmin\Renderers\Alert;
|
||||
use Slowlyo\OwlAdmin\Renderers\InputKV;
|
||||
use Slowlyo\OwlAdmin\Renderers\TextControl;
|
||||
use Slowlyo\OwlAdmin\Controllers\AdminController;
|
||||
|
||||
class SettingController extends AdminController
|
||||
{
|
||||
|
|
@ -50,7 +47,7 @@ class SettingController extends AdminController
|
|||
{
|
||||
$data = $request->only([
|
||||
'upload_disk',
|
||||
'oss_config'
|
||||
'oss_config',
|
||||
]);
|
||||
|
||||
//上传设置-修改env文件内配置;
|
||||
|
|
@ -78,6 +75,7 @@ class SettingController extends AdminController
|
|||
return $key.'='.$value;
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
});
|
||||
|
||||
|
|
@ -85,7 +83,6 @@ class SettingController extends AdminController
|
|||
\File::put($envPath, $content);
|
||||
}
|
||||
|
||||
|
||||
return settings()->adminSetMany($data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class StoreController extends AdminController
|
|||
->extractValue(false)
|
||||
->clearable(),
|
||||
amisMake()->SelectControl()->name('business_status')->label(__('store.business_status'))->columnRatio(3)->clearable(),
|
||||
])
|
||||
]),
|
||||
]))
|
||||
->columns([
|
||||
amisMake()->TableColumn()->name('id')->label(__('store.id')),
|
||||
|
|
@ -62,6 +62,7 @@ class StoreController extends AdminController
|
|||
$this->rowDeleteButton(),
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->baseList($crud);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Admin\Filters;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use EloquentFilter\ModelFilter;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class AdFilter extends ModelFilter
|
||||
{
|
||||
|
|
@ -14,6 +14,7 @@ class AdFilter extends ModelFilter
|
|||
{
|
||||
return $this->where('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
|
@ -29,8 +30,11 @@ class AdFilter extends ModelFilter
|
|||
{
|
||||
return $this->where('address', $address);
|
||||
}
|
||||
public function publishedAt($publishedAt){
|
||||
|
||||
public function publishedAt($publishedAt)
|
||||
{
|
||||
$publishedAt = explode(',', $publishedAt);
|
||||
|
||||
return $this->where(function ($q) use ($publishedAt) {
|
||||
$startAt = Arr::get($publishedAt, 0) ?? null;
|
||||
$endAt = Arr::get($publishedAt, 1) ?? null;
|
||||
|
|
@ -43,8 +47,10 @@ class AdFilter extends ModelFilter
|
|||
});
|
||||
}
|
||||
|
||||
public function createdAt($createdAt){
|
||||
public function createdAt($createdAt)
|
||||
{
|
||||
$createdAt = explode(',', $createdAt);
|
||||
|
||||
return $this->where(function ($q) use ($createdAt) {
|
||||
$startAt = Arr::get($createdAt, 0) ?? null;
|
||||
$endAt = Arr::get($createdAt, 1) ?? null;
|
||||
|
|
@ -57,7 +63,8 @@ class AdFilter extends ModelFilter
|
|||
});
|
||||
}
|
||||
|
||||
public function enable($enable){
|
||||
public function enable($enable)
|
||||
{
|
||||
return $this->where('is_enable', $enable);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class ArticleFilter extends ModelFilter
|
|||
{
|
||||
return $this->where('id', $id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
|
|
@ -33,8 +34,10 @@ class ArticleFilter extends ModelFilter
|
|||
/**
|
||||
* 查询带有标签的文章
|
||||
*/
|
||||
public function tIds($tIds){
|
||||
public function tIds($tIds)
|
||||
{
|
||||
$tIds = explode(',', $tIds);
|
||||
|
||||
return $this->where(function ($q) use ($tIds) {
|
||||
foreach ($tIds as $tId) {
|
||||
$q->whereRaw("FIND_IN_SET('".$tId."',t_ids)");
|
||||
|
|
@ -42,8 +45,10 @@ class ArticleFilter extends ModelFilter
|
|||
});
|
||||
}
|
||||
|
||||
public function publishedAt($publishedAt){
|
||||
public function publishedAt($publishedAt)
|
||||
{
|
||||
$publishedAt = explode(',', $publishedAt);
|
||||
|
||||
return $this->where(function ($q) use ($publishedAt) {
|
||||
$startAt = Arr::get($publishedAt, 0) ?? null;
|
||||
$endAt = Arr::get($publishedAt, 1) ?? null;
|
||||
|
|
@ -56,8 +61,10 @@ class ArticleFilter extends ModelFilter
|
|||
});
|
||||
}
|
||||
|
||||
public function createdAt($createdAt){
|
||||
public function createdAt($createdAt)
|
||||
{
|
||||
$createdAt = explode(',', $createdAt);
|
||||
|
||||
return $this->where(function ($q) use ($createdAt) {
|
||||
$startAt = Arr::get($createdAt, 0) ?? null;
|
||||
$endAt = Arr::get($createdAt, 1) ?? null;
|
||||
|
|
@ -70,11 +77,13 @@ class ArticleFilter extends ModelFilter
|
|||
});
|
||||
}
|
||||
|
||||
public function enable($enable){
|
||||
public function enable($enable)
|
||||
{
|
||||
return $this->where('is_enable', $enable);
|
||||
}
|
||||
|
||||
public function recommend($recommend){
|
||||
public function recommend($recommend)
|
||||
{
|
||||
return $this->where('is_recommend', $recommend);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace App\Admin\Filters;
|
||||
|
||||
use EloquentFilter\ModelFilter;
|
||||
use App\Models\Keyword;
|
||||
use EloquentFilter\ModelFilter;
|
||||
|
||||
class KeywordFilter extends ModelFilter
|
||||
{
|
||||
|
|
@ -24,6 +24,7 @@ class KeywordFilter extends ModelFilter
|
|||
->orWhere('key', 'like', '%'.$parent_name.'%');
|
||||
});
|
||||
}
|
||||
|
||||
return $this->orWhere('path', 'like', '%-'.
|
||||
Keyword::where('name', 'like', '%'.$parent_name.'%')->orWhere('key', 'like', '%'.$parent_name.'%')->value('id')
|
||||
.'-%' ?? '');
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ class Menu
|
|||
unset($list[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ class AdService extends BaseService
|
|||
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
|
||||
break;
|
||||
case Ad::TYPE_APP:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');
|
||||
break;
|
||||
case Ad::TYPE_MINI:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -93,10 +93,10 @@ class AdService extends BaseService
|
|||
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
|
||||
break;
|
||||
case Ad::TYPE_APP:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], 'app_link');
|
||||
break;
|
||||
case Ad::TYPE_MINI:
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);;
|
||||
$data['jump_config'] = Arr::only($data['jump_config'], ['mini_id', 'mini_link']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace App\Admin\Services;
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
|
||||
/**
|
||||
* @method AdminUser getModel()
|
||||
|
|
@ -136,13 +136,6 @@ class AdminUserService extends BaseService
|
|||
return compact('items', 'total');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param array $columns
|
||||
* @param AdminUser $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function saveData($data, array $columns, AdminUser $model): bool
|
||||
{
|
||||
$roles = Arr::pull($data, 'roles');
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class BaseService extends AdminService
|
|||
{
|
||||
$list = $this->query()->orderByDesc('sort')->get();
|
||||
$minNum = $list->min('parent_id');
|
||||
|
||||
return array2tree($list->toArray(), $minNum);
|
||||
}
|
||||
|
||||
|
|
@ -63,6 +64,7 @@ class BaseService extends AdminService
|
|||
$validate = $this->validate($data);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -78,6 +80,7 @@ class BaseService extends AdminService
|
|||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -90,8 +93,10 @@ class BaseService extends AdminService
|
|||
$result = $this->preDelete($id);
|
||||
if ($result !== true) {
|
||||
$this->setError($result);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->query()->whereIn($this->primaryKey(), $id)->delete();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ namespace App\Admin\Services;
|
|||
|
||||
use App\Admin\Filters\EmployeeFilter;
|
||||
use App\Models\Employee;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Slowlyo\OwlAdmin\Services\AdminUserService;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Slowlyo\OwlAdmin\Services\AdminUserService;
|
||||
|
||||
class EmployeeService extends BaseService
|
||||
{
|
||||
|
|
@ -26,6 +26,7 @@ class EmployeeService extends BaseService
|
|||
$validate = $this->validate($data);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +46,7 @@ class EmployeeService extends BaseService
|
|||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +77,7 @@ class EmployeeService extends BaseService
|
|||
if (Arr::hasAny($data, ['username', 'password', 'confirm_password'])) {
|
||||
if (! $adminUserService->update($model->admin_user_id, Arr::only($data, ['username', 'password', 'confirm_password']))) {
|
||||
$this->setError($adminUserService->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -82,11 +85,13 @@ class EmployeeService extends BaseService
|
|||
// 添加管理员信息
|
||||
if (! $adminUserService->store(Arr::only($data, ['username', 'password', 'confirm_password']))) {
|
||||
$this->setError($adminUserService->getError());
|
||||
|
||||
return false;
|
||||
}
|
||||
$adminUser = AdminUser::where('username', $data['username'])->first();
|
||||
$data['admin_user_id'] = $adminUser->id;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +112,7 @@ class EmployeeService extends BaseService
|
|||
$adminUserIds = Employee::whereIn('id', $ids)->pluck('admin_user_id')->implode(',');
|
||||
$adminUserService = AdminUserService::make();
|
||||
$adminUserService->delete($adminUserIds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -124,6 +130,7 @@ class EmployeeService extends BaseService
|
|||
if ($validator->fails()) {
|
||||
return $validator->errors()->first();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,12 +13,14 @@ use Illuminate\Support\Arr;
|
|||
class KeywordService extends BaseService
|
||||
{
|
||||
protected string $modelName = Keyword::class;
|
||||
|
||||
protected string $modelFilterName = KeywordFilter::class;
|
||||
|
||||
public function getTree()
|
||||
{
|
||||
$list = $this->query()->filter(request()->all(), $this->modelFilterName)->get();
|
||||
$minNum = $list->min('parent_id');
|
||||
|
||||
return ! $list->isEmpty() ? array2tree($list->toArray(), $minNum) : [];
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +77,7 @@ class KeywordService extends BaseService
|
|||
if ($pid != 0) {
|
||||
if ($this->parentIsChild($primaryKey, $pid)) {
|
||||
$this->setError('父级不允许设置为当前子权限');
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -98,6 +101,7 @@ class KeywordService extends BaseService
|
|||
|
||||
if ((clone $query)->where('key', $data['key'])->exists()) {
|
||||
$this->setError('KEY重复');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
namespace App\Admin\Services;
|
||||
|
||||
use App\Admin\Filters\StoreFilter;
|
||||
use App\Models\Store;
|
||||
use App\Enums\StoreRole;
|
||||
use App\Models\Store;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
|
|
@ -23,6 +23,7 @@ class StoreService extends BaseService
|
|||
$validate = $this->validate($data);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ class StoreService extends BaseService
|
|||
$validate = $this->validate($data, $model);
|
||||
if ($validate !== true) {
|
||||
$this->setError($validate);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +61,7 @@ class StoreService extends BaseService
|
|||
$data['lon'] = data_get($data['location'], 'lng');
|
||||
$data['lat'] = data_get($data['location'], 'lat');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +78,7 @@ class StoreService extends BaseService
|
|||
'lat' => ['required'],
|
||||
];
|
||||
$updateRules = [
|
||||
'master_id' => [Rule::unique($model, 'master_id')]
|
||||
'master_id' => [Rule::unique($model, 'master_id')],
|
||||
];
|
||||
$validator = Validator::make($data, $model ? $updateRules : $createRules, [
|
||||
'master_id.unique' => '已经是店长了',
|
||||
|
|
@ -83,6 +86,7 @@ class StoreService extends BaseService
|
|||
if ($validator->fails()) {
|
||||
return $validator->errors()->first();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Casts;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Storage as StorageFacades;
|
||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||
use Illuminate\Support\Facades\Storage as StorageFacades;
|
||||
use Illuminate\Support\Str;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
|
||||
/**
|
||||
* 转换文件存储路径
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ enum BusinessStatus: int
|
|||
foreach (self::map() as $key => $value) {
|
||||
array_push($list, ['label' => $value, 'value' => $key]);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ enum EmployeeStatus: int
|
|||
foreach (self::map() as $key => $value) {
|
||||
array_push($list, ['label' => $value, 'value' => $key]);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ enum StoreRole: int
|
|||
foreach (self::map() as $key => $value) {
|
||||
array_push($list, ['label' => $value, 'value' => $key]);
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,19 +2,21 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Casts\Storage;
|
||||
|
||||
class Ad extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Filterable;
|
||||
use HasFactory;
|
||||
|
||||
public const TYPE_OFF = 0; //无跳转
|
||||
|
||||
public const TYPE_WEB = 1; //网页跳转
|
||||
|
||||
public const TYPE_APP = 2; //应用跳转
|
||||
|
||||
public const TYPE_MINI = 3; //小程序跳转
|
||||
|
||||
protected function serializeDate(\DateTimeInterface $date)
|
||||
|
|
@ -58,7 +60,7 @@ class Ad extends Model
|
|||
self::TYPE_WEB => "<span class='label label-info'>网页跳转</span>",
|
||||
self::TYPE_APP => "<span class='label label-warning'>应用跳转</span>",
|
||||
self::TYPE_MINI => "<span class='label label-green'>小程序跳转</span>",
|
||||
'*'=>'其他:${jump_type}'
|
||||
'*' => '其他:${jump_type}',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -68,11 +70,12 @@ class Ad extends Model
|
|||
self::TYPE_IN => "<span class='label label-info'>入住缴费</span>",
|
||||
self::TYPE_CONTINUE => "<span class='label label-warning'>续住缴费</span>",
|
||||
self::TYPE_EXIT => "<span class='label label-danger'>离开结算</span>",
|
||||
'*'=>'其他:${live_in}'
|
||||
'*' => '其他:${live_in}',
|
||||
];
|
||||
}
|
||||
|
||||
public function scopeShow(){
|
||||
public function scopeShow()
|
||||
{
|
||||
$q->where('is_enable', true)->where('published_at', '>=', now());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class AdminUser extends Model
|
|||
}
|
||||
|
||||
$parent = $allMenus->get($parent->parent_id);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
unset($allMenus, $roleMenus);
|
||||
|
|
|
|||
|
|
@ -2,16 +2,15 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Casts\Storage;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Article extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Filterable;
|
||||
use HasFactory;
|
||||
|
||||
protected function serializeDate(\DateTimeInterface $date)
|
||||
{
|
||||
|
|
@ -42,7 +41,8 @@ class Article extends Model
|
|||
'appendixes',
|
||||
];
|
||||
|
||||
public function scopeShow(){
|
||||
public function scopeShow()
|
||||
{
|
||||
$q->where('is_enable', true)->where('published_at', '>=', now());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Enums\EmployeeStatus;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Traits\HasDateTimeFormatter;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Slowlyo\OwlAdmin\Models\AdminUser;
|
||||
|
||||
/**
|
||||
* 员工
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ use Illuminate\Support\Str;
|
|||
|
||||
class Keyword extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use Filterable;
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = ['name', 'key', 'value', 'parent_id', 'parent_key', 'path', 'sort', 'lv'];
|
||||
|
||||
|
|
@ -67,12 +67,13 @@ class Keyword extends Model
|
|||
.'-%' ?? '');
|
||||
}
|
||||
|
||||
public static function tagsMap(String $key)
|
||||
public static function tagsMap(string $key)
|
||||
{
|
||||
$mapArr = [];
|
||||
self::query()->where('parent_key', $key)->get()->map(function ($item) use (&$mapArr) {
|
||||
$mapArr[$item->id] = Components::make()->keywordsTag($item->name, $item->value);
|
||||
});
|
||||
|
||||
return $mapArr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Enums\BusinessStatus;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use EloquentFilter\Filterable;
|
||||
use App\Traits\HasDateTimeFormatter;
|
||||
use EloquentFilter\Filterable;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* 门店
|
||||
|
|
|
|||
|
|
@ -35,10 +35,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Database\Events\QueryExecuted $query
|
||||
* @return string
|
||||
*/
|
||||
protected function prepareSql(QueryExecuted $query): string
|
||||
{
|
||||
$sql = str_replace(['%', '?'], ['%%', '%s'], $query->sql);
|
||||
|
|
@ -54,7 +50,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
|
|||
|
||||
/**
|
||||
* @param float $milliseconds
|
||||
* @return string
|
||||
*/
|
||||
protected function formatDuration($milliseconds): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,23 +2,16 @@
|
|||
|
||||
namespace App\Traits;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Slowlyo\OwlAdmin\Renderers\Drawer;
|
||||
use Slowlyo\OwlAdmin\Renderers\Dialog;
|
||||
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
|
||||
use Slowlyo\OwlAdmin\Renderers\DialogAction;
|
||||
use Slowlyo\OwlAdmin\Renderers\Drawer;
|
||||
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
|
||||
use Slowlyo\OwlAdmin\Renderers\LinkAction;
|
||||
|
||||
trait CustomActionTrait
|
||||
{
|
||||
/**
|
||||
* 新增按钮
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $size
|
||||
* @param string $width
|
||||
*
|
||||
* @return DialogAction|DrawerAction|LinkAction
|
||||
*/
|
||||
protected function createTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
|
||||
{
|
||||
|
|
@ -51,12 +44,6 @@ trait CustomActionTrait
|
|||
|
||||
/**
|
||||
* 行编辑按钮
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $size
|
||||
* @param string $width
|
||||
*
|
||||
* @return DialogAction|DrawerAction|LinkAction
|
||||
*/
|
||||
protected function rowEditTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
|
||||
{
|
||||
|
|
@ -99,12 +86,6 @@ trait CustomActionTrait
|
|||
|
||||
/**
|
||||
* 行详情按钮
|
||||
*
|
||||
* @param string $type
|
||||
* @param string $size
|
||||
* @param string $width
|
||||
*
|
||||
* @return DialogAction|DrawerAction|LinkAction
|
||||
*/
|
||||
protected function rowShowTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
namespace App\Traits;
|
||||
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Slowlyo\OwlAdmin\Admin;
|
||||
|
||||
trait UploadTrait
|
||||
{
|
||||
|
|
@ -66,7 +66,7 @@ trait UploadTrait
|
|||
return $this->response()->success(['value' => $path]);
|
||||
}
|
||||
|
||||
public function saveImage($field = 'image', $path)
|
||||
public function saveImage($field, $path)
|
||||
{
|
||||
return $this->saveFile($field, $path);
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ trait UploadTrait
|
|||
/**
|
||||
* 表单提交时,转存实际目录,并保留上传时文件名称;文件保存全路径
|
||||
*/
|
||||
public function saveFile($field = 'file', $path)
|
||||
public function saveFile($field, $path)
|
||||
{
|
||||
$file = request()->file($field);
|
||||
|
||||
|
|
@ -122,6 +122,7 @@ trait UploadTrait
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $fileArr;
|
||||
}
|
||||
|
||||
|
|
@ -167,6 +168,7 @@ trait UploadTrait
|
|||
$path = $file->storeAs($dirPath, $fileName.'_'.$partNumber, Admin::config('admin.upload.disk'));
|
||||
$realPath = Storage::disk(Admin::config('admin.upload.disk'))->url($path);
|
||||
$eTag = md5_file($realPath);
|
||||
|
||||
return $this->response()->success(['eTag' => $eTag]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ return [
|
|||
],
|
||||
|
||||
'upload' => [
|
||||
'disk' => env("FILESYSTEM_DISK", 'public'),
|
||||
'disk' => env('FILESYSTEM_DISK', 'public'),
|
||||
// 文件上传目录
|
||||
'directory' => [
|
||||
'image' => 'images',
|
||||
|
|
|
|||
|
|
@ -56,21 +56,21 @@ return [
|
|||
'throw' => false,
|
||||
],
|
||||
|
||||
"oss" => [
|
||||
"driver" => "oss",
|
||||
"access_key_id" => env("OSS_ACCESS_KEY_ID"), // 必填, 阿里云的AccessKeyId
|
||||
"access_key_secret" => env("OSS_ACCESS_KEY_SECRET"), // 必填, 阿里云的AccessKeySecret
|
||||
"bucket" => env("OSS_BUCKET"), // 必填, 对象存储的Bucket, 示例: my-bucket
|
||||
"endpoint" => env("OSS_ENDPOINT"), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com
|
||||
"internal" => env("OSS_INTERNAL", null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com
|
||||
"domain" => env("OSS_DOMAIN", null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com
|
||||
"is_cname" => env("OSS_CNAME", false), // 选填, 若Endpoint为自定义域名,此项要为true,见:https://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78
|
||||
"prefix" => env("OSS_PREFIX", ""), // 选填, 统一存储地址前缀
|
||||
"use_ssl" => env("OSS_SSL", false), // 选填, 是否使用HTTPS
|
||||
"reverse_proxy" => env("OSS_REVERSE_PROXY", false), // 选填, 域名是否使用NGINX代理绑定
|
||||
"throw" => env("OSS_THROW", true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false
|
||||
"options" => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false]
|
||||
"macros" => [] // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class]
|
||||
'oss' => [
|
||||
'driver' => 'oss',
|
||||
'access_key_id' => env('OSS_ACCESS_KEY_ID'), // 必填, 阿里云的AccessKeyId
|
||||
'access_key_secret' => env('OSS_ACCESS_KEY_SECRET'), // 必填, 阿里云的AccessKeySecret
|
||||
'bucket' => env('OSS_BUCKET'), // 必填, 对象存储的Bucket, 示例: my-bucket
|
||||
'endpoint' => env('OSS_ENDPOINT'), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com
|
||||
'internal' => env('OSS_INTERNAL', null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com
|
||||
'domain' => env('OSS_DOMAIN', null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com
|
||||
'is_cname' => env('OSS_CNAME', false), // 选填, 若Endpoint为自定义域名,此项要为true,见:https://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78
|
||||
'prefix' => env('OSS_PREFIX', ''), // 选填, 统一存储地址前缀
|
||||
'use_ssl' => env('OSS_SSL', false), // 选填, 是否使用HTTPS
|
||||
'reverse_proxy' => env('OSS_REVERSE_PROXY', false), // 选填, 域名是否使用NGINX代理绑定
|
||||
'throw' => env('OSS_THROW', true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false
|
||||
'options' => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false]
|
||||
'macros' => [], // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class]
|
||||
],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Slowlyo\OwlAdmin\Models\AdminMenu;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Slowlyo\OwlAdmin\Models\AdminMenu;
|
||||
use Throwable;
|
||||
|
||||
class AdminMenuSeeder extends Seeder
|
||||
|
|
@ -27,15 +26,15 @@ class AdminMenuSeeder extends Seeder
|
|||
['title' => 'admin_permission', 'icon' => 'carbon:user-role', 'url' => '/system/admin_permissions', 'order' => 3],
|
||||
['title' => 'admin_menu', 'icon' => 'fluent-mdl2:permissions', 'url' => '/system/admin_menus', 'order' => 4],
|
||||
['title' => 'admin_setting', 'icon' => 'akar-icons:settings-horizontal', 'url' => '/system/settings', 'order' => 5],
|
||||
['title' => 'keywords', 'icon' => 'ph:codesandbox-logo-light', 'url' => '/system/keywords', 'order'=>6]
|
||||
['title' => 'keywords', 'icon' => 'ph:codesandbox-logo-light', 'url' => '/system/keywords', 'order' => 6],
|
||||
],
|
||||
],
|
||||
['title' => 'web_content', 'icon' => 'ic:outline-collections-bookmark', 'url' => '', 'order' => 3,
|
||||
'children' => [
|
||||
['title' => 'articles', 'icon' => 'ic:outline-article', 'url' => '/articles', 'order' => 1],
|
||||
['title' => 'ads', 'icon' => 'lets-icons:img-box', 'url' => '/ads', 'order' => 2],
|
||||
]
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
DB::table('admin_menus')->truncate();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class KeywordSeeder extends Seeder
|
|||
[
|
||||
'key' => 'job',
|
||||
'name' => '职位',
|
||||
'children' => ['普通员工', '小组长', '主管']
|
||||
'children' => ['普通员工', '小组长', '主管'],
|
||||
],
|
||||
[
|
||||
'key' => 'store_category',
|
||||
|
|
@ -54,7 +54,7 @@ class KeywordSeeder extends Seeder
|
|||
['name' => '电脑整机'],
|
||||
['name' => '外设产品'],
|
||||
['name' => '网络产品'],
|
||||
]]
|
||||
]],
|
||||
],
|
||||
],
|
||||
[
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ return [
|
|||
'fill' => '填充',
|
||||
'save_current_config' => '保存当前配置',
|
||||
'input_config_name' => '请填写配置名称',
|
||||
'same_name_tips' => '相同名称的配置将会被覆盖'
|
||||
'same_name_tips' => '相同名称的配置将会被覆盖',
|
||||
],
|
||||
|
||||
'admin_users' => '管理员',
|
||||
|
|
|
|||
Loading…
Reference in New Issue