编码风格

main
Jing Li 2024-03-23 19:59:59 +08:00
parent 7efc12327e
commit 970cef0c32
47 changed files with 976 additions and 948 deletions

View File

@ -6,12 +6,12 @@ use App\Models\Keyword;
use Slowlyo\OwlAdmin\Renderers\BaseRenderer; use Slowlyo\OwlAdmin\Renderers\BaseRenderer;
use Slowlyo\OwlAdmin\Renderers\WangEditor; use Slowlyo\OwlAdmin\Renderers\WangEditor;
class Components extends BaseRenderer { class Components extends BaseRenderer
{
/** /**
* 父级选择器 * 父级选择器
*/ */
public function parentControl($apiUrl = null, $name ='parent_id', $label = null, $labelField = 'name', $valueField = 'id') public function parentControl($apiUrl = null, $name = 'parent_id', $label = null, $labelField = 'name', $valueField = 'id')
{ {
return amisMake()->TreeSelectControl()->source($apiUrl) return amisMake()->TreeSelectControl()->source($apiUrl)
->name($name)->label($label ?? __('admin.components.parent_select')) ->name($name)->label($label ?? __('admin.components.parent_select'))
@ -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() return amisMake()->NumberControl()
->name($name)->label($label ?? __('admin.components.order')) ->name($name)->label($label ?? __('admin.components.order'))
->displayMode('enhance') ->displayMode('enhance')
@ -34,7 +35,8 @@ class Components extends BaseRenderer {
/** /**
* 2位小数输入框 * 2位小数输入框
*/ */
public function decimalControl($name ='decimal', $label = null){ public function decimalControl($name = 'decimal', $label = null)
{
return amisMake()->NumberControl() return amisMake()->NumberControl()
->name($name)->label($label ?? __('admin.components.decimal')) ->name($name)->label($label ?? __('admin.components.decimal'))
->kilobitSeparator(true) ->kilobitSeparator(true)
@ -47,7 +49,7 @@ class Components extends BaseRenderer {
/** /**
* 富文本编辑器 * 富文本编辑器
*/ */
public function fuEditorControl($name ='content', $label = null, $height = 530) public function fuEditorControl($name = 'content', $label = null, $height = 530)
{ {
return WangEditor::make() return WangEditor::make()
->name($name)->label($label ?? __('admin.components.content')) ->name($name)->label($label ?? __('admin.components.content'))
@ -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() return amisMake()->SwitchControl()
->name($name)->label($label ?? __('admin.components.status')) ->name($name)->label($label ?? __('admin.components.status'))
->mode($mode) ->mode($mode)
@ -68,39 +71,44 @@ class Components extends BaseRenderer {
/** /**
* 图片上传 * 图片上传
*/ */
public function imageControl($name, $label){ public function imageControl($name, $label)
{
return amis()->ImageControl($name, $label) return amis()->ImageControl($name, $label)
->joinValues(false) ->joinValues(false)
->autoUpload(true)->maxSize('5*1024*1024');//不能大于5M ->autoUpload(true)->maxSize('5*1024*1024'); //不能大于5M
} }
/** /**
* 图片上传,带裁剪 * 图片上传,带裁剪
*/ */
public function cropImageControl($name, $label, $aspectRatio = null){ public function cropImageControl($name, $label, $aspectRatio = null)
{
$cropImage = amis()->ImageControl($name, $label)->joinValues(false); $cropImage = amis()->ImageControl($name, $label)->joinValues(false);
// if($aspectRatio){ // if($aspectRatio){
$cropImage->crop([ $cropImage->crop([
'aspectRatio' => $aspectRatio ?? 1 'aspectRatio' => $aspectRatio ?? 1,
]); ]);
// } // }
$cropImage->autoUpload(true); $cropImage->autoUpload(true);
return $cropImage; 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')) return amis()->FileControl($name, $label ?? __('admin.components.files'))
->multiple($multiple) ->multiple($multiple)
->joinValues(false) ->joinValues(false)
->useChunk(false) ->useChunk(false)
->maxSize(20*1024*1024) ->maxSize(20 * 1024 * 1024)
->accept($accept); ->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')) return amis()->FileControl($name, $label ?? __('admin.components.files'))
->multiple($multiple) ->multiple($multiple)
->joinValues(false) ->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() return amisMake()->TagControl()
->name($name)->label($label ?? __('admin.components.tag')) ->name($name)->label($label ?? __('admin.components.tag'))
->maxTagLength(0) ->maxTagLength(0)
->options(Keyword::where('parent_key', $pKey)->pluck('name', 'id')->toArray()); ->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){ {
if ($color) {
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag')) $tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
->displayMode('rounded')->style([ ->displayMode('rounded')->style([
'color' => '#fff', 'color' => '#fff',
'backgroundColor' =>$color, 'backgroundColor' => $color,
'borderColor' => $color 'borderColor' => $color,
]); ]);
}else{ } else {
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag')) $tag = amisMake()->Tag()->label($label ?? __('admin.components.tag'))
->displayMode('rounded')->color('inactive'); ->displayMode('rounded')->color('inactive');
} }
return $tag; return $tag;
} }
@ -140,36 +151,37 @@ class Components extends BaseRenderer {
* 生成统计图config * 生成统计图config
* 折线图或者柱状图 * 折线图或者柱状图
*/ */
public function chartLineBarConfig($title = null, array $x , array $y){ public function chartLineBarConfig($title, array $x, array $y)
{
$yAxisData = []; $yAxisData = [];
$seriesData = []; $seriesData = [];
$color = []; $color = [];
if(!isset($y[0])){ if (! isset($y[0])) {
$_y = $y; $_y = $y;
$y = [0=>$_y]; $y = [0 => $_y];
} }
$i = 0; $i = 0;
$tips = '{b0}'; $tips = '{b0}';
foreach($y as $item) { foreach ($y as $item) {
//调色盘 //调色盘
$color[] = $item['color']; $color[] = $item['color'];
//tips //tips
$tips.= '<br/> {a'.$i.'}: {c'.$i.'}'.($item['unit'] ?? ''); $tips .= '<br/> {a'.$i.'}: {c'.$i.'}'.($item['unit'] ?? '');
//纵坐标 //纵坐标
$yAxisData[] = [ $yAxisData[] = [
'name'=>($item['unit'] ?? ''), 'name' => ($item['unit'] ?? ''),
'type' =>'value', 'type' => 'value',
'axisTick' => true, 'axisTick' => true,
'alignTicks' => true, 'alignTicks' => true,
'axisLine' => [ 'axisLine' => [
'show' => true, 'show' => true,
'lineStyle' => [ 'lineStyle' => [
'color' => $item['color'] ?? '' 'color' => $item['color'] ?? '',
] ],
],
'axisLabel' => [
'formatter' => '{value} ',
], ],
'axisLabel'=> [
'formatter'=>'{value} '
]
]; ];
//数据 //数据
$_series = [ $_series = [
@ -178,16 +190,16 @@ class Components extends BaseRenderer {
'type' => $item['type'] ?? 'line', 'type' => $item['type'] ?? 'line',
'yAxisIndex' => $i, 'yAxisIndex' => $i,
]; ];
switch($item['type']){ switch ($item['type']) {
case 'line': case 'line':
$_series = array_merge($_series, [ $_series = array_merge($_series, [
'smooth'=> true, 'smooth' => true,
'symbol'=> 'none', 'symbol' => 'none',
'lineStyle' => [ 'lineStyle' => [
'color' => $item['color'] ?? '' 'color' => $item['color'] ?? '',
], ],
'areaStyle' => [ 'areaStyle' => [
'color' => $item['color'] ?? '' 'color' => $item['color'] ?? '',
], ],
]); ]);
break; break;
@ -205,10 +217,10 @@ class Components extends BaseRenderer {
'title' => [ 'title' => [
'text' => $title, 'text' => $title,
], ],
"tooltip" => [//提示 'tooltip' => [//提示
'trigger'=>'axis',//坐标轴触发 'trigger' => 'axis', //坐标轴触发
'axisPointer' => [ 'axisPointer' => [
'type' => 'cross' 'type' => 'cross',
], ],
// 'formatter' => $tips // 'formatter' => $tips
], ],
@ -221,21 +233,22 @@ class Components extends BaseRenderer {
'data' => $x, 'data' => $x,
], ],
'yAxis' => $yAxisData, '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 = []; $yAxisData = [];
$seriesData = []; $seriesData = [];
$color = []; $color = [];
if($yData){ if ($yData) {
$yAxisData = [ $yAxisData = [
'type' =>'category', 'type' => 'category',
// 'splitLine'=>[ // 'splitLine'=>[
// 'show'=>true, // 'show'=>true,
// 'lineStyle'=>[ // 'lineStyle'=>[
@ -243,9 +256,9 @@ class Components extends BaseRenderer {
// ] // ]
// ], // ],
'axisTick' => [ 'axisTick' => [
'alignWithLabel'=>true 'alignWithLabel' => true,
], ],
'data'=> $yData 'data' => $yData,
]; ];
} }
@ -256,10 +269,10 @@ class Components extends BaseRenderer {
'title' => [ 'title' => [
'text' => $title, 'text' => $title,
], ],
"tooltip" => [//提示 'tooltip' => [//提示
'trigger'=>'axis',//坐标轴触发 'trigger' => 'axis', //坐标轴触发
'axisPointer' => [ 'axisPointer' => [
'type' => 'cross' 'type' => 'cross',
], ],
], ],
'xAxis' => [ 'xAxis' => [
@ -267,7 +280,7 @@ class Components extends BaseRenderer {
'data' => $x, 'data' => $x,
], ],
'yAxis' => $yAxisData, 'yAxis' => $yAxisData,
'series' => $seriesData 'series' => $seriesData,
]; ];
} }
@ -275,7 +288,8 @@ class Components extends BaseRenderer {
* 生成饼状图config * 生成饼状图config
* -todo * -todo
*/ */
public function chartPieConfig(){ public function chartPieConfig()
return ; {
} }
} }

View File

@ -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'), 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')) amis()->SelectControl('enable', __('admin.ads.is_enable'))
->options([ ->options([
1=>'开启',0=>'关闭' 1 => '开启', 0 => '关闭',
]), ]),
]), ]),
amis()->GroupControl()->mode('horizontal')->body([ amis()->GroupControl()->mode('horizontal')->body([
@ -61,7 +61,7 @@ class AdController extends AdminController
Operation::make()->label(__('admin.actions'))->buttons([ Operation::make()->label(__('admin.actions'))->buttons([
$this->rowEditButton(), $this->rowEditButton(),
$this->rowDeleteButton(), $this->rowDeleteButton(),
]) ]),
]); ]);
return $this->baseList($crud); return $this->baseList($crud);
@ -91,7 +91,7 @@ class AdController extends AdminController
return $this->baseDetail()->body([ return $this->baseDetail()->body([
amis()->TextControl('id', 'ID')->static(), amis()->TextControl('id', 'ID')->static(),
amis()->TextControl('created_at', __('admin.created_at'))->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(),
]); ]);
} }
} }

View File

@ -2,8 +2,8 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Slowlyo\OwlAdmin\Renderers\Page;
use Slowlyo\OwlAdmin\Controllers\AdminRoleController as AdminRoleBaseController; use Slowlyo\OwlAdmin\Controllers\AdminRoleController as AdminRoleBaseController;
use Slowlyo\OwlAdmin\Renderers\Page;
class AdminRoleController extends AdminRoleBaseController class AdminRoleController extends AdminRoleBaseController
{ {

View File

@ -83,8 +83,8 @@ class AdminUserController extends AdminController
amisMake()->Dialog()->title(__('admin.admin_user.edit_password'))->body([ amisMake()->Dialog()->title(__('admin.admin_user.edit_password'))->body([
amisMake()->Form()->title('') amisMake()->Form()->title('')
->api([ ->api([
'method'=>'PUT', 'method' => 'PUT',
'url'=> admin_url('system/admin_users/$id') 'url' => admin_url('system/admin_users/$id'),
]) ])
->body([ ->body([
amisMake()->TextControl('id')->value('${id}')->hidden(true), amisMake()->TextControl('id')->value('${id}')->hidden(true),

View File

@ -4,7 +4,6 @@ namespace App\Admin\Controllers;
use App\Admin\Components; use App\Admin\Components;
use App\Admin\Services\ArticleService; use App\Admin\Services\ArticleService;
use App\Casts\Storage;
use App\Models\Keyword; use App\Models\Keyword;
use App\Traits\CustomActionTrait; use App\Traits\CustomActionTrait;
use Slowlyo\OwlAdmin\Admin; use Slowlyo\OwlAdmin\Admin;
@ -15,9 +14,10 @@ use Slowlyo\OwlAdmin\Renderers\Page;
class ArticleController extends AdminController class ArticleController extends AdminController
{ {
use CustomActionTrait; use CustomActionTrait;
protected string $serviceName = ArticleService::class; protected string $serviceName = ArticleService::class;
public function list():Page public function list(): Page
{ {
$crud = $this->baseCRUD()->tableLayout('fixed') $crud = $this->baseCRUD()->tableLayout('fixed')
->headerToolbar([ ->headerToolbar([
@ -37,12 +37,12 @@ class ArticleController extends AdminController
amis()->SelectControl('enable', __('admin.articles.is_enable')) amis()->SelectControl('enable', __('admin.articles.is_enable'))
->columnRatio(3) ->columnRatio(3)
->options([ ->options([
1=>'开启',0=>'关闭' 1 => '开启', 0 => '关闭',
]), ]),
amis()->SelectControl('recommend', __('admin.articles.is_recommend')) amis()->SelectControl('recommend', __('admin.articles.is_recommend'))
->columnRatio(3) ->columnRatio(3)
->options([ ->options([
1=>'开启',0=>'关闭' 1 => '开启', 0 => '关闭',
]), ]),
amis()->InputDatetimeRange()->label(__('admin.articles.published_at'))->name('published_at'), amis()->InputDatetimeRange()->label(__('admin.articles.published_at'))->name('published_at'),
]), ]),
@ -56,7 +56,7 @@ class ArticleController extends AdminController
'position' => 'top-left', 'position' => 'top-left',
'badgeLevel' => 'danger', 'badgeLevel' => 'danger',
'visibleOn' => '${is_recommend > 0}', 'visibleOn' => '${is_recommend > 0}',
'size' => 15 'size' => 15,
]) ])
->columns([ ->columns([
amis()->TableColumn('id', __('admin.id'))->sortable(true), amis()->TableColumn('id', __('admin.id'))->sortable(true),
@ -73,7 +73,7 @@ class ArticleController extends AdminController
amis()->Operation()->label(__('admin.actions'))->buttons([ amis()->Operation()->label(__('admin.actions'))->buttons([
$this->rowEditTypeButton('drawer', 'xl'), $this->rowEditTypeButton('drawer', 'xl'),
$this->rowDeleteButton(), $this->rowDeleteButton(),
]) ]),
]); ]);
return $this->baseList($crud); return $this->baseList($crud);
@ -96,7 +96,7 @@ class ArticleController extends AdminController
])->md(4), ])->md(4),
amis()->Wrapper()->body([ amis()->Wrapper()->body([
Components::make()->fuEditorControl('content', __('admin.articles.content')), Components::make()->fuEditorControl('content', __('admin.articles.content')),
])->md(8) ])->md(8),
]), ]),
]); ]);
} }
@ -105,5 +105,4 @@ class ArticleController extends AdminController
{ {
return $this->baseDetail()->body([]); return $this->baseDetail()->body([]);
} }
} }

View File

@ -2,19 +2,19 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Slowlyo\OwlAdmin\Admin;
use Illuminate\Http\Request; 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\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 class AuthController extends AdminAuthController
{ {
public function login(Request $request) public function login(Request $request)
{ {
if (Admin::config('admin.auth.login_captcha')) { if (Admin::config('admin.auth.login_captcha')) {
if (!$request->has('captcha')) { if (! $request->has('captcha')) {
return $this->response()->fail(__('admin.required', ['attribute' => __('admin.captcha')])); return $this->response()->fail(__('admin.required', ['attribute' => __('admin.captcha')]));
} }
@ -28,7 +28,7 @@ class AuthController extends AdminAuthController
'username' => 'required', 'username' => 'required',
'password' => 'required', 'password' => 'required',
], [ ], [
'username' . '.required' => __('admin.required', ['attribute' => __('admin.username')]), 'username'.'.required' => __('admin.required', ['attribute' => __('admin.username')]),
'password.required' => __('admin.required', ['attribute' => __('admin.password')]), 'password.required' => __('admin.required', ['attribute' => __('admin.password')]),
]); ]);
@ -39,13 +39,14 @@ class AuthController extends AdminAuthController
$adminModel = Admin::adminUserModel(); $adminModel = Admin::adminUserModel();
$user = $adminModel::query()->where('username', $request->username)->first(); $user = $adminModel::query()->where('username', $request->username)->first();
if($user && $user->lock){ if ($user && $user->lock) {
abort(Response::HTTP_BAD_REQUEST, '您的账号已被锁定,需要联系超级管理员解锁。'); abort(Response::HTTP_BAD_REQUEST, '您的账号已被锁定,需要联系超级管理员解锁。');
}else{ } else {
if ($user && Hash::check($request->password, $user->password)) { if ($user && Hash::check($request->password, $user->password)) {
$module = Admin::currentModule(true); $module = Admin::currentModule(true);
$prefix = $module ? $module . '.' : ''; $prefix = $module ? $module.'.' : '';
$token = $user->createToken($prefix . 'admin')->plainTextToken; $token = $user->createToken($prefix.'admin')->plainTextToken;
return $this->response()->success(compact('token'), __('admin.login_successful')); return $this->response()->success(compact('token'), __('admin.login_successful'));
} }

View File

@ -3,17 +3,17 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Illuminate\Http\JsonResponse; 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 Illuminate\Http\Resources\Json\JsonResource;
use Slowlyo\OwlAdmin\Controllers\AdminController; 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 class HomeController extends AdminController
{ {
@ -47,7 +47,7 @@ class HomeController extends AdminController
return Card::make() return Card::make()
->className('h-full clear-card-mb') ->className('h-full clear-card-mb')
->body( ->body(
Custom::make()->html(<<<HTML Custom::make()->html(<<<'HTML'
<div class="h-full flex flex-col mt-5 py-5 px-7"> <div class="h-full flex flex-col mt-5 py-5 px-7">
<div></div> <div></div>
<div class="flex flex-1 items-center w-full justify-center" id="hitokoto"> <div class="flex flex-1 items-center w-full justify-center" id="hitokoto">
@ -64,12 +64,12 @@ class HomeController extends AdminController
</div> </div>
HTML HTML
)->onMount(<<<JS )->onMount(<<<'JS'
fetch('https://v1.hitokoto.cn?c=i') fetch('https://v1.hitokoto.cn?c=i')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
const hitokoto = document.querySelector('#hitokoto_text') 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 hitokoto.innerText = data.hitokoto
document.querySelector('#hitokoto_from_who').innerText = data.from_who document.querySelector('#hitokoto_from_who').innerText = data.from_who
document.querySelector('#hitokoto_from').innerText = data.from document.querySelector('#hitokoto_from').innerText = data.from
@ -88,7 +88,7 @@ JS
Custom::make() Custom::make()
->name('clock') ->name('clock')
->html('<div id="clock" class="text-4xl"></div><div id="clock-date" class="mt-5"></div>') ->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 clock = document.getElementById('clock');
const tick = () => { const tick = () => {
clock.innerHTML = (new Date()).toLocaleTimeString(); clock.innerHTML = (new Date()).toLocaleTimeString();
@ -176,7 +176,8 @@ JS
for ($i = 0; $i < 7; $i++) { for ($i = 0; $i < 7; $i++) {
$_arr[] = random_int(10, 200); $_arr[] = random_int(10, 200);
} }
return '[' . implode(',', $_arr) . ']';
return '['.implode(',', $_arr).']';
}; };
$random1 = $randArr(); $random1 = $randArr();
@ -201,7 +202,7 @@ series: [
public function cube(): Card public function cube(): Card
{ {
return Card::make()->className('h-96 ml-4 w-8/12')->body( return Card::make()->className('h-96 ml-4 w-8/12')->body(
Html::make()->html(<<<HTML Html::make()->html(<<<'HTML'
<style> <style>
.cube-box{ height: 300px; display: flex; align-items: center; justify-content: center; } .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; } .cube { width: 100px; height: 100px; position: relative; transform-style: preserve-3d; animation: rotate 10s linear infinite; }

View File

@ -44,7 +44,7 @@ class EmployeeController extends AdminController
->level('link') ->level('link')
->icon('fa fa-sign-out') ->icon('fa fa-sign-out')
->confirmText(__('employee.leave_confirm')) ->confirmText(__('employee.leave_confirm'))
->api('post:' . admin_url('hr/employees/${id}/leave')), ->api('post:'.admin_url('hr/employees/${id}/leave')),
]), ]),
]); ]);
@ -58,14 +58,14 @@ class EmployeeController extends AdminController
amisMake()->TextControl()->name('phone')->label(__('employee.phone'))->required(), amisMake()->TextControl()->name('phone')->label(__('employee.phone'))->required(),
amisMake()->TagControl()->name('jobs')->label(__('employee.jobs')) amisMake()->TagControl()->name('jobs')->label(__('employee.jobs'))
->source(admin_url('api/keywords/tree-list') . '?parent_key=' . Employee::JOB_KEY) ->source(admin_url('api/keywords/tree-list').'?parent_key='.Employee::JOB_KEY)
->labelField('name') ->labelField('name')
->valueField('key') ->valueField('key')
->joinValues(), ->joinValues(),
amisMake()->DateControl()->name('join_at')->label(__('employee.join_at'))->format('YYYY-MM-DD'), amisMake()->DateControl()->name('join_at')->label(__('employee.join_at'))->format('YYYY-MM-DD'),
amisMake()->TextControl()->name('username')->label(__('admin.username'))->value('${admin_user.username}')->required(!$edit), amisMake()->TextControl()->name('username')->label(__('admin.username'))->value('${admin_user.username}')->required(! $edit),
amisMake()->TextControl()->name('password')->set('type', 'input-password')->label(__('admin.password'))->required(!$edit), amisMake()->TextControl()->name('password')->set('type', 'input-password')->label(__('admin.password'))->required(! $edit),
amisMake()->TextControl()->name('confirm_password')->set('type', 'input-password')->label(__('admin.confirm_password'))->required(!$edit), amisMake()->TextControl()->name('confirm_password')->set('type', 'input-password')->label(__('admin.confirm_password'))->required(! $edit),
]); ]);
} }

View File

@ -2,11 +2,10 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Slowlyo\OwlAdmin\Controllers\AdminController;
use App\Traits\UploadTrait; use App\Traits\UploadTrait;
use Slowlyo\OwlAdmin\Controllers\AdminController;
class IndexController extends AdminController class IndexController extends AdminController
{ {
use UploadTrait; use UploadTrait;
} }

View File

@ -33,7 +33,7 @@ class KeywordController extends AdminController
->placeholder(__('admin.keywords.search_name')), ->placeholder(__('admin.keywords.search_name')),
amis()->TextControl('parent_name', __('admin.keywords.parent_keyword')) amis()->TextControl('parent_name', __('admin.keywords.parent_keyword'))
->size('md') ->size('md')
->placeholder(__('admin.keywords.search_name')) ->placeholder(__('admin.keywords.search_name')),
] ]
)) ))
->columns([ ->columns([
@ -63,7 +63,8 @@ class KeywordController extends AdminController
]); ]);
} }
public function getTreeList(Request $request){ public function getTreeList(Request $request)
{
return $this->service->getTree(); return $this->service->getTree();
} }
} }

View File

@ -2,14 +2,11 @@
namespace App\Admin\Controllers; namespace App\Admin\Controllers;
use Illuminate\Support\Arr;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Slowlyo\OwlAdmin\Controllers\AdminController;
use Slowlyo\OwlAdmin\Renderers\Tab; use Slowlyo\OwlAdmin\Renderers\Tab;
use Slowlyo\OwlAdmin\Renderers\Tabs; 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 class SettingController extends AdminController
{ {
@ -32,7 +29,7 @@ class SettingController extends AdminController
Tabs::make()->tabs([ Tabs::make()->tabs([
Tab::make()->title('上传设置')->body([ Tab::make()->title('上传设置')->body([
amis()->RadiosControl('upload_disk', '上传驱动')->options([ amis()->RadiosControl('upload_disk', '上传驱动')->options([
'public'=>'本地存储', 'public' => '本地存储',
'oss' => '阿里云OSS', 'oss' => '阿里云OSS',
])->value('public')->required(true), ])->value('public')->required(true),
amis()->TextControl('oss_config.access_key_id', '阿里云AccessKeyId')->required(true)->size('lg')->visibleOn('${upload_disk == "oss"}'), amis()->TextControl('oss_config.access_key_id', '阿里云AccessKeyId')->required(true)->size('lg')->visibleOn('${upload_disk == "oss"}'),
@ -50,34 +47,35 @@ class SettingController extends AdminController
{ {
$data = $request->only([ $data = $request->only([
'upload_disk', 'upload_disk',
'oss_config' 'oss_config',
]); ]);
//上传设置-修改env文件内配置 //上传设置-修改env文件内配置
if(!empty($data['upload_disk'])){ if (! empty($data['upload_disk'])) {
$envData['FILESYSTEM_DISK'] = $data['upload_disk']; $envData['FILESYSTEM_DISK'] = $data['upload_disk'];
if($envData['FILESYSTEM_DISK'] == 'oss'){//如果设置为OSS驱动则配置env变量 if ($envData['FILESYSTEM_DISK'] == 'oss') {//如果设置为OSS驱动则配置env变量
$envData['OSS_ACCESS_KEY_ID'] = Arr::get($data['oss_config'], 'access_key_id'); $envData['OSS_ACCESS_KEY_ID'] = Arr::get($data['oss_config'], 'access_key_id');
$envData['OSS_ACCESS_KEY_SECRET'] = Arr::get($data['oss_config'], 'access_key_secret'); $envData['OSS_ACCESS_KEY_SECRET'] = Arr::get($data['oss_config'], 'access_key_secret');
$envData['OSS_BUCKET'] = Arr::get($data['oss_config'], 'bucket'); $envData['OSS_BUCKET'] = Arr::get($data['oss_config'], 'bucket');
$envData['OSS_ENDPOINT'] = Arr::get($data['oss_config'], 'endpoint'); $envData['OSS_ENDPOINT'] = Arr::get($data['oss_config'], 'endpoint');
$envData['OSS_DOMAIN'] = Arr::get($data['oss_config'], 'domain'); $envData['OSS_DOMAIN'] = Arr::get($data['oss_config'], 'domain');
if(!empty($envData['OSS_DOMAIN'])){ if (! empty($envData['OSS_DOMAIN'])) {
$envData['OSS_CNAME'] = 'true'; $envData['OSS_CNAME'] = 'true';
}else{ } else {
$envData['OSS_CNAME'] = 'false'; $envData['OSS_CNAME'] = 'false';
} }
$envData['OSS_SSL'] = Arr::get($data['oss_config'], 'use_ssl') ? 'true':'false'; $envData['OSS_SSL'] = Arr::get($data['oss_config'], 'use_ssl') ? 'true' : 'false';
} }
$envPath = base_path() . DIRECTORY_SEPARATOR . '.env'; $envPath = base_path().DIRECTORY_SEPARATOR.'.env';
$contentArray = collect(file($envPath, FILE_IGNORE_NEW_LINES)); $contentArray = collect(file($envPath, FILE_IGNORE_NEW_LINES));
$contentArray->transform(function ($item) use ($envData){ $contentArray->transform(function ($item) use ($envData) {
foreach ($envData as $key => $value){ foreach ($envData as $key => $value) {
if(str_contains($item, $key)){ if (str_contains($item, $key)) {
return $key . '=' . $value; return $key.'='.$value;
} }
} }
return $item; return $item;
}); });
@ -85,7 +83,6 @@ class SettingController extends AdminController
\File::put($envPath, $content); \File::put($envPath, $content);
} }
return settings()->adminSetMany($data); return settings()->adminSetMany($data);
} }
} }

View File

@ -45,7 +45,7 @@ class StoreController extends AdminController
->extractValue(false) ->extractValue(false)
->clearable(), ->clearable(),
amisMake()->SelectControl()->name('business_status')->label(__('store.business_status'))->columnRatio(3)->clearable(), amisMake()->SelectControl()->name('business_status')->label(__('store.business_status'))->columnRatio(3)->clearable(),
]) ]),
])) ]))
->columns([ ->columns([
amisMake()->TableColumn()->name('id')->label(__('store.id')), amisMake()->TableColumn()->name('id')->label(__('store.id')),
@ -62,6 +62,7 @@ class StoreController extends AdminController
$this->rowDeleteButton(), $this->rowDeleteButton(),
]), ]),
]); ]);
return $this->baseList($crud); return $this->baseList($crud);
} }

View File

@ -2,8 +2,8 @@
namespace App\Admin\Filters; namespace App\Admin\Filters;
use Illuminate\Support\Arr;
use EloquentFilter\ModelFilter; use EloquentFilter\ModelFilter;
use Illuminate\Support\Arr;
class AdFilter extends ModelFilter class AdFilter extends ModelFilter
{ {
@ -14,12 +14,13 @@ class AdFilter extends ModelFilter
{ {
return $this->where('id', $id); return $this->where('id', $id);
} }
/** /**
* 备注 * 备注
*/ */
public function remark($remark) public function remark($remark)
{ {
return $this->where('remark','like', '%'.$remark.'%'); return $this->where('remark', 'like', '%'.$remark.'%');
} }
/** /**
@ -29,35 +30,41 @@ class AdFilter extends ModelFilter
{ {
return $this->where('address', $address); return $this->where('address', $address);
} }
public function publishedAt($publishedAt){
$publishedAt = explode(',',$publishedAt); public function publishedAt($publishedAt)
return $this->where(function($q) use ($publishedAt) { {
$publishedAt = explode(',', $publishedAt);
return $this->where(function ($q) use ($publishedAt) {
$startAt = Arr::get($publishedAt, 0) ?? null; $startAt = Arr::get($publishedAt, 0) ?? null;
$endAt = Arr::get($publishedAt, 1) ?? null; $endAt = Arr::get($publishedAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('published_at', '>=', $startAt); $q->where('published_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('published_at', '<=', $endAt); $q->where('published_at', '<=', $endAt);
} }
}); });
} }
public function createdAt($createdAt){ public function createdAt($createdAt)
$createdAt = explode(',',$createdAt); {
return $this->where(function($q) use ($createdAt) { $createdAt = explode(',', $createdAt);
return $this->where(function ($q) use ($createdAt) {
$startAt = Arr::get($createdAt, 0) ?? null; $startAt = Arr::get($createdAt, 0) ?? null;
$endAt = Arr::get($createdAt, 1) ?? null; $endAt = Arr::get($createdAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('created_at', '>=', $startAt); $q->where('created_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('created_at', '<=', $endAt); $q->where('created_at', '<=', $endAt);
} }
}); });
} }
public function enable($enable){ public function enable($enable)
{
return $this->where('is_enable', $enable); return $this->where('is_enable', $enable);
} }
} }

View File

@ -14,12 +14,13 @@ class ArticleFilter extends ModelFilter
{ {
return $this->where('id', $id); return $this->where('id', $id);
} }
/** /**
* 标题 * 标题
*/ */
public function title($title) public function title($title)
{ {
return $this->where('title','like', '%'.$title.'%'); return $this->where('title', 'like', '%'.$title.'%');
} }
/** /**
@ -33,48 +34,56 @@ class ArticleFilter extends ModelFilter
/** /**
* 查询带有标签的文章 * 查询带有标签的文章
*/ */
public function tIds($tIds){ public function tIds($tIds)
$tIds = explode(',',$tIds); {
return $this->where(function($q) use ($tIds) { $tIds = explode(',', $tIds);
return $this->where(function ($q) use ($tIds) {
foreach ($tIds as $tId) { foreach ($tIds as $tId) {
$q->whereRaw("FIND_IN_SET('".$tId."',t_ids)"); $q->whereRaw("FIND_IN_SET('".$tId."',t_ids)");
} }
}); });
} }
public function publishedAt($publishedAt){ public function publishedAt($publishedAt)
$publishedAt = explode(',',$publishedAt); {
return $this->where(function($q) use ($publishedAt) { $publishedAt = explode(',', $publishedAt);
return $this->where(function ($q) use ($publishedAt) {
$startAt = Arr::get($publishedAt, 0) ?? null; $startAt = Arr::get($publishedAt, 0) ?? null;
$endAt = Arr::get($publishedAt, 1) ?? null; $endAt = Arr::get($publishedAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('published_at', '>=', $startAt); $q->where('published_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('published_at', '<=', $endAt); $q->where('published_at', '<=', $endAt);
} }
}); });
} }
public function createdAt($createdAt){ public function createdAt($createdAt)
$createdAt = explode(',',$createdAt); {
return $this->where(function($q) use ($createdAt) { $createdAt = explode(',', $createdAt);
return $this->where(function ($q) use ($createdAt) {
$startAt = Arr::get($createdAt, 0) ?? null; $startAt = Arr::get($createdAt, 0) ?? null;
$endAt = Arr::get($createdAt, 1) ?? null; $endAt = Arr::get($createdAt, 1) ?? null;
if(!empty($startAt)){ if (! empty($startAt)) {
$q->where('created_at', '>=', $startAt); $q->where('created_at', '>=', $startAt);
} }
if(!empty($endAt)){ if (! empty($endAt)) {
$q->where('created_at', '<=', $endAt); $q->where('created_at', '<=', $endAt);
} }
}); });
} }
public function enable($enable){ public function enable($enable)
{
return $this->where('is_enable', $enable); return $this->where('is_enable', $enable);
} }
public function recommend($recommend){ public function recommend($recommend)
{
return $this->where('is_recommend', $recommend); return $this->where('is_recommend', $recommend);
} }
} }

View File

@ -9,7 +9,7 @@ class EmployeeFilter extends ModelFilter
public function search($key) public function search($key)
{ {
$condition = '%'.$key.'%'; $condition = '%'.$key.'%';
$this->where(fn($q) => $q->where('name', 'like', $condition)->orWhere('phone', 'like', $condition)); $this->where(fn ($q) => $q->where('name', 'like', $condition)->orWhere('phone', 'like', $condition));
} }
public function name($key) public function name($key)

View File

@ -2,8 +2,8 @@
namespace App\Admin\Filters; namespace App\Admin\Filters;
use EloquentFilter\ModelFilter;
use App\Models\Keyword; use App\Models\Keyword;
use EloquentFilter\ModelFilter;
class KeywordFilter extends ModelFilter class KeywordFilter extends ModelFilter
{ {
@ -12,21 +12,22 @@ class KeywordFilter extends ModelFilter
*/ */
public function name($name) public function name($name)
{ {
return $this->where('name','like', '%'.$name.'%') return $this->where('name', 'like', '%'.$name.'%')
->orWhere('key','like', '%'.$name.'%'); ->orWhere('key', 'like', '%'.$name.'%');
} }
public function parentName($parent_name) public function parentName($parent_name)
{ {
if(request('has_owner', 1)){ if (request('has_owner', 1)) {
$this->where(function($q) use ($parent_name){ $this->where(function ($q) use ($parent_name) {
$q->where('name','like', '%'.$parent_name.'%') $q->where('name', 'like', '%'.$parent_name.'%')
->orWhere('key','like', '%'.$parent_name.'%'); ->orWhere('key', 'like', '%'.$parent_name.'%');
}); });
} }
return $this->orWhere('path','like', '%-'.
Keyword::where('name','like', '%'.$parent_name.'%')->orWhere('key','like', '%'.$parent_name.'%')->value('id') return $this->orWhere('path', 'like', '%-'.
. '-%' ?? ''); Keyword::where('name', 'like', '%'.$parent_name.'%')->orWhere('key', 'like', '%'.$parent_name.'%')->value('id')
.'-%' ?? '');
} }
public function parentKey($key) public function parentKey($key)

View File

@ -12,7 +12,7 @@ class Menu
public function all() public function all()
{ {
$menus = $this->userMenus() $menus = $this->userMenus()
->push(...array_map(fn($item) => $this->formatItem($item), $this->menus)) ->push(...array_map(fn ($item) => $this->formatItem($item), $this->menus))
->sortBy('order') ->sortBy('order')
->values() ->values()
->toArray(); ->toArray();
@ -35,7 +35,7 @@ class Menu
if ($item['parent_id'] == $parentId) { if ($item['parent_id'] == $parentId) {
$idStr = "[{$item['id']}]"; $idStr = "[{$item['id']}]";
$_temp = [ $_temp = [
'name' => $parentName ? $parentName . '-' . $idStr : $idStr, 'name' => $parentName ? $parentName.'-'.$idStr : $idStr,
'path' => $item['url'], 'path' => $item['url'],
'component' => data_get($item, 'component') ?? 'amis', 'component' => data_get($item, 'component') ?? 'amis',
'is_home' => $item['is_home'], 'is_home' => $item['is_home'],
@ -49,20 +49,21 @@ class Menu
], ],
]; ];
$children = $this->list2Menu($list, (int)$item['id'], $_temp['name']); $children = $this->list2Menu($list, (int) $item['id'], $_temp['name']);
if (!empty($children)) { if (! empty($children)) {
$_temp['component'] = 'amis'; $_temp['component'] = 'amis';
$_temp['children'] = $children; $_temp['children'] = $children;
} }
$data[] = $_temp; $data[] = $_temp;
if (!in_array($_temp['path'], Admin::config('admin.route.without_extra_routes'))) { if (! in_array($_temp['path'], Admin::config('admin.route.without_extra_routes'))) {
array_push($data, ...$this->generateRoute($_temp)); array_push($data, ...$this->generateRoute($_temp));
} }
unset($list[$key]); unset($list[$key]);
} }
} }
return $data; return $data;
} }
@ -71,18 +72,18 @@ class Menu
$url = $item['path'] ?? ''; $url = $item['path'] ?? '';
$url = preg_replace('/\?.*/', '', $url); $url = preg_replace('/\?.*/', '', $url);
if (!$url || array_key_exists('children', $item)) { if (! $url || array_key_exists('children', $item)) {
return []; return [];
} }
$menu = fn($action, $path) => [ $menu = fn ($action, $path) => [
'name' => $item['name'] . '-' . $action, 'name' => $item['name'].'-'.$action,
'path' => $url . $path, 'path' => $url.$path,
'component' => 'amis', 'component' => 'amis',
'meta' => [ 'meta' => [
'hide' => true, 'hide' => true,
'icon' => Arr::get($item, 'meta.icon'), 'icon' => Arr::get($item, 'meta.icon'),
'title' => Arr::get($item, 'meta.title') . ' - ' . __('admin.' . $action), 'title' => Arr::get($item, 'meta.title').' - '.__('admin.'.$action),
], ],
]; ];

View File

@ -32,14 +32,14 @@ class AdService extends BaseService
$data['published_at'] = now(); $data['published_at'] = now();
} }
if(isset($data['resource'])){ if (isset($data['resource'])) {
$data['resource'] = $this->saveImage('resource', 'ads/resource')[0]; $data['resource'] = $this->saveImage('resource', 'ads/resource')[0];
} }
//处理跳转配置 //处理跳转配置
$jumpType = Arr::get($data, 'jump_type'); $jumpType = Arr::get($data, 'jump_type');
if($jumpType !== null){ if ($jumpType !== null) {
switch($jumpType){ switch ($jumpType) {
case Ad::TYPE_OFF: case Ad::TYPE_OFF:
$data['jump_config'] = null; $data['jump_config'] = null;
break; break;
@ -47,16 +47,16 @@ class AdService extends BaseService
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link'); $data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
break; break;
case Ad::TYPE_APP: 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; break;
case Ad::TYPE_MINI: 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; break;
} }
} }
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -78,14 +78,14 @@ class AdService extends BaseService
$data['published_at'] = now(); $data['published_at'] = now();
} }
if(isset($data['resource'])){ if (isset($data['resource'])) {
$data['resource'] = $this->saveImage('resource', 'ads/resource')[0]; $data['resource'] = $this->saveImage('resource', 'ads/resource')[0];
} }
//处理跳转配置 //处理跳转配置
$jumpType = Arr::get($data, 'jump_type'); $jumpType = Arr::get($data, 'jump_type');
if($jumpType !== null){ if ($jumpType !== null) {
switch($jumpType){ switch ($jumpType) {
case Ad::TYPE_OFF: case Ad::TYPE_OFF:
$data['jump_config'] = null; $data['jump_config'] = null;
break; break;
@ -93,16 +93,16 @@ class AdService extends BaseService
$data['jump_config'] = Arr::only($data['jump_config'], 'web_link'); $data['jump_config'] = Arr::only($data['jump_config'], 'web_link');
break; break;
case Ad::TYPE_APP: 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; break;
case Ad::TYPE_MINI: 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; break;
} }
} }
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }

View File

@ -2,12 +2,12 @@
namespace App\Admin\Services; 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\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() * @method AdminUser getModel()
@ -37,11 +37,11 @@ class AdminUserService extends BaseService
return $this->setError(__('admin.admin_user.username_already_exists')); return $this->setError(__('admin.admin_user.username_already_exists'));
} }
if (!data_get($data, 'password')) { if (! data_get($data, 'password')) {
return $this->setError(__('admin.required', ['attribute' => __('admin.password')])); return $this->setError(__('admin.required', ['attribute' => __('admin.password')]));
} }
if (!$this->passwordHandler($data)) { if (! $this->passwordHandler($data)) {
return false; return false;
} }
@ -58,7 +58,7 @@ class AdminUserService extends BaseService
return $this->setError(__('admin.admin_user.username_already_exists')); return $this->setError(__('admin.admin_user.username_already_exists'));
} }
if (!$this->passwordHandler($data)) { if (! $this->passwordHandler($data)) {
return false; return false;
} }
@ -73,13 +73,13 @@ class AdminUserService extends BaseService
{ {
return $this->query() return $this->query()
->where('username', $username) ->where('username', $username)
->when($id, fn($query) => $query->where('id', '<>', $id)) ->when($id, fn ($query) => $query->where('id', '<>', $id))
->exists(); ->exists();
} }
public function updateUserSetting($primaryKey, $data): bool public function updateUserSetting($primaryKey, $data): bool
{ {
if (!$this->passwordHandler($data, $primaryKey)) { if (! $this->passwordHandler($data, $primaryKey)) {
return false; return false;
} }
@ -96,13 +96,13 @@ class AdminUserService extends BaseService
} }
if ($id) { if ($id) {
if (!Arr::get($data, 'old_password')) { if (! Arr::get($data, 'old_password')) {
return $this->setError(__('admin.admin_user.old_password_required')); return $this->setError(__('admin.admin_user.old_password_required'));
} }
$oldPassword = $this->query()->where('id', $id)->value('password'); $oldPassword = $this->query()->where('id', $id)->value('password');
if (!Hash::check($data['old_password'], $oldPassword)) { if (! Hash::check($data['old_password'], $oldPassword)) {
return $this->setError(__('admin.admin_user.old_password_error')); return $this->setError(__('admin.admin_user.old_password_error'));
} }
} }
@ -136,19 +136,12 @@ class AdminUserService extends BaseService
return compact('items', 'total'); return compact('items', 'total');
} }
/**
* @param $data
* @param array $columns
* @param AdminUser $model
*
* @return bool
*/
protected function saveData($data, array $columns, AdminUser $model): bool protected function saveData($data, array $columns, AdminUser $model): bool
{ {
$roles = Arr::pull($data, 'roles'); $roles = Arr::pull($data, 'roles');
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }

View File

@ -36,7 +36,7 @@ class ArticleService extends BaseService
$data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes'); $data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes');
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -58,16 +58,16 @@ class ArticleService extends BaseService
$data['published_at'] = now(); $data['published_at'] = now();
} }
if(isset($data['cover'])){ if (isset($data['cover'])) {
$data['cover'] = $this->saveImage('cover', 'articles/cover')[0] ?? ''; $data['cover'] = $this->saveImage('cover', 'articles/cover')[0] ?? '';
} }
if(isset($data['appendixes'])){ if (isset($data['appendixes'])) {
$data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes'); $data['appendixes'] = $this->saveFile('appendixes', 'articles/appendixes');
} }
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }

View File

@ -20,6 +20,7 @@ class BaseService extends AdminService
{ {
$list = $this->query()->orderByDesc('sort')->get(); $list = $this->query()->orderByDesc('sort')->get();
$minNum = $list->min('parent_id'); $minNum = $list->min('parent_id');
return array2tree($list->toArray(), $minNum); return array2tree($list->toArray(), $minNum);
} }
@ -34,7 +35,7 @@ class BaseService extends AdminService
$filter = $this->getModelFilter(); $filter = $this->getModelFilter();
$query = $this->query(); $query = $this->query();
if($this->withRelationships){ if ($this->withRelationships) {
$query->with($this->withRelationships); $query->with($this->withRelationships);
} }
@ -42,7 +43,7 @@ class BaseService extends AdminService
$query->filter(request()->input(), $filter); $query->filter(request()->input(), $filter);
} }
if($this->modelSortAble){ if ($this->modelSortAble) {
$query->sort(); $query->sort();
} }
@ -63,6 +64,7 @@ class BaseService extends AdminService
$validate = $this->validate($data); $validate = $this->validate($data);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -78,6 +80,7 @@ class BaseService extends AdminService
$validate = $this->validate($data, $model); $validate = $this->validate($data, $model);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -90,8 +93,10 @@ class BaseService extends AdminService
$result = $this->preDelete($id); $result = $this->preDelete($id);
if ($result !== true) { if ($result !== true) {
$this->setError($result); $this->setError($result);
return false; return false;
} }
return $this->query()->whereIn($this->primaryKey(), $id)->delete(); return $this->query()->whereIn($this->primaryKey(), $id)->delete();
} }

View File

@ -4,12 +4,12 @@ namespace App\Admin\Services;
use App\Admin\Filters\EmployeeFilter; use App\Admin\Filters\EmployeeFilter;
use App\Models\Employee; 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\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 class EmployeeService extends BaseService
{ {
@ -26,6 +26,7 @@ class EmployeeService extends BaseService
$validate = $this->validate($data); $validate = $this->validate($data);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -45,6 +46,7 @@ class EmployeeService extends BaseService
$validate = $this->validate($data, $model); $validate = $this->validate($data, $model);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -60,7 +62,7 @@ class EmployeeService extends BaseService
$model = $this->getModel(); $model = $this->getModel();
$hidden = collect([$model->getCreatedAtColumn(), $model->getUpdatedAtColumn()]) $hidden = collect([$model->getCreatedAtColumn(), $model->getUpdatedAtColumn()])
->filter(fn($item) => $item !== null) ->filter(fn ($item) => $item !== null)
->toArray(); ->toArray();
return $this->query()->with(['adminUser', 'jobs'])->find($id)->makeHidden($hidden); return $this->query()->with(['adminUser', 'jobs'])->find($id)->makeHidden($hidden);
@ -73,20 +75,23 @@ class EmployeeService extends BaseService
if ($model) { if ($model) {
// 修改管理员信息 // 修改管理员信息
if (Arr::hasAny($data, ['username', 'password', 'confirm_password'])) { if (Arr::hasAny($data, ['username', 'password', 'confirm_password'])) {
if (!$adminUserService->update($model->admin_user_id, Arr::only($data, ['username', 'password', 'confirm_password']))) { if (! $adminUserService->update($model->admin_user_id, Arr::only($data, ['username', 'password', 'confirm_password']))) {
$this->setError($adminUserService->getError()); $this->setError($adminUserService->getError());
return false; return false;
} }
} }
} else { } else {
// 添加管理员信息 // 添加管理员信息
if (!$adminUserService->store(Arr::only($data, ['username', 'password', 'confirm_password']))) { if (! $adminUserService->store(Arr::only($data, ['username', 'password', 'confirm_password']))) {
$this->setError($adminUserService->getError()); $this->setError($adminUserService->getError());
return false; return false;
} }
$adminUser = AdminUser::where('username', $data['username'])->first(); $adminUser = AdminUser::where('username', $data['username'])->first();
$data['admin_user_id'] = $adminUser->id; $data['admin_user_id'] = $adminUser->id;
} }
return $data; return $data;
} }
@ -107,6 +112,7 @@ class EmployeeService extends BaseService
$adminUserIds = Employee::whereIn('id', $ids)->pluck('admin_user_id')->implode(','); $adminUserIds = Employee::whereIn('id', $ids)->pluck('admin_user_id')->implode(',');
$adminUserService = AdminUserService::make(); $adminUserService = AdminUserService::make();
$adminUserService->delete($adminUserIds); $adminUserService->delete($adminUserIds);
return true; return true;
} }
@ -118,12 +124,13 @@ class EmployeeService extends BaseService
]; ];
$updateRules = []; $updateRules = [];
$validator = Validator::make($data, $model ? $updateRules : $createRules, [ $validator = Validator::make($data, $model ? $updateRules : $createRules, [
'name.required' => __('employee.name') . '必填', 'name.required' => __('employee.name').'必填',
'phone.required' => __('employee.phone') . '必填', 'phone.required' => __('employee.phone').'必填',
]); ]);
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); return $validator->errors()->first();
} }
return true; return true;
} }
} }

View File

@ -13,13 +13,15 @@ use Illuminate\Support\Arr;
class KeywordService extends BaseService class KeywordService extends BaseService
{ {
protected string $modelName = Keyword::class; protected string $modelName = Keyword::class;
protected string $modelFilterName = KeywordFilter::class; protected string $modelFilterName = KeywordFilter::class;
public function getTree() public function getTree()
{ {
$list = $this->query()->filter(request()->all(), $this->modelFilterName)->get(); $list = $this->query()->filter(request()->all(), $this->modelFilterName)->get();
$minNum = $list->min('parent_id'); $minNum = $list->min('parent_id');
return !$list->isEmpty() ? array2tree($list->toArray(), $minNum) :[];
return ! $list->isEmpty() ? array2tree($list->toArray(), $minNum) : [];
} }
public function parentIsChild($id, $pid): bool public function parentIsChild($id, $pid): bool
@ -53,7 +55,7 @@ class KeywordService extends BaseService
$model = $this->getModel(); $model = $this->getModel();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -75,6 +77,7 @@ class KeywordService extends BaseService
if ($pid != 0) { if ($pid != 0) {
if ($this->parentIsChild($primaryKey, $pid)) { if ($this->parentIsChild($primaryKey, $pid)) {
$this->setError('父级不允许设置为当前子权限'); $this->setError('父级不允许设置为当前子权限');
return false; return false;
} }
} }
@ -82,7 +85,7 @@ class KeywordService extends BaseService
$model = $this->query()->whereKey($primaryKey)->first(); $model = $this->query()->whereKey($primaryKey)->first();
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
if (!in_array($k, $columns)) { if (! in_array($k, $columns)) {
continue; continue;
} }
@ -94,10 +97,11 @@ class KeywordService extends BaseService
public function hasRepeated($data, $id = 0): bool public function hasRepeated($data, $id = 0): bool
{ {
$query = $this->query()->when($id, fn($query) => $query->where('id', '<>', $id)); $query = $this->query()->when($id, fn ($query) => $query->where('id', '<>', $id));
if ((clone $query)->where('key', $data['key'])->exists()) { if ((clone $query)->where('key', $data['key'])->exists()) {
$this->setError('KEY重复'); $this->setError('KEY重复');
return true; return true;
} }
@ -107,7 +111,7 @@ class KeywordService extends BaseService
public function delete(string $ids): mixed public function delete(string $ids): mixed
{ {
$ids = explode(',', $ids); $ids = explode(',', $ids);
if(count($ids) == 1){ if (count($ids) == 1) {
$this->query()->where('path', 'like', '%-'.$ids[0].'-%')->delete(); $this->query()->where('path', 'like', '%-'.$ids[0].'-%')->delete();
} }

View File

@ -3,8 +3,8 @@
namespace App\Admin\Services; namespace App\Admin\Services;
use App\Admin\Filters\StoreFilter; use App\Admin\Filters\StoreFilter;
use App\Models\Store;
use App\Enums\StoreRole; use App\Enums\StoreRole;
use App\Models\Store;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule; use Illuminate\Validation\Rule;
@ -23,6 +23,7 @@ class StoreService extends BaseService
$validate = $this->validate($data); $validate = $this->validate($data);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -41,6 +42,7 @@ class StoreService extends BaseService
$validate = $this->validate($data, $model); $validate = $this->validate($data, $model);
if ($validate !== true) { if ($validate !== true) {
$this->setError($validate); $this->setError($validate);
return false; return false;
} }
@ -59,6 +61,7 @@ class StoreService extends BaseService
$data['lon'] = data_get($data['location'], 'lng'); $data['lon'] = data_get($data['location'], 'lng');
$data['lat'] = data_get($data['location'], 'lat'); $data['lat'] = data_get($data['location'], 'lat');
} }
return $data; return $data;
} }
@ -75,7 +78,7 @@ class StoreService extends BaseService
'lat' => ['required'], 'lat' => ['required'],
]; ];
$updateRules = [ $updateRules = [
'master_id' => [Rule::unique($model, 'master_id')] 'master_id' => [Rule::unique($model, 'master_id')],
]; ];
$validator = Validator::make($data, $model ? $updateRules : $createRules, [ $validator = Validator::make($data, $model ? $updateRules : $createRules, [
'master_id.unique' => '已经是店长了', 'master_id.unique' => '已经是店长了',
@ -83,6 +86,7 @@ class StoreService extends BaseService
if ($validator->fails()) { if ($validator->fails()) {
return $validator->errors()->first(); return $validator->errors()->first();
} }
return true; return true;
} }
} }

View File

@ -2,10 +2,10 @@
namespace App\Casts; 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\Contracts\Database\Eloquent\CastsAttributes;
use Illuminate\Support\Facades\Storage as StorageFacades;
use Illuminate\Support\Str;
use Slowlyo\OwlAdmin\Admin;
/** /**
* 转换文件存储路径 * 转换文件存储路径

View File

@ -32,6 +32,7 @@ enum BusinessStatus: int
foreach (self::map() as $key => $value) { foreach (self::map() as $key => $value) {
array_push($list, ['label' => $value, 'value' => $key]); array_push($list, ['label' => $value, 'value' => $key]);
} }
return $list; return $list;
} }

View File

@ -32,6 +32,7 @@ enum EmployeeStatus: int
foreach (self::map() as $key => $value) { foreach (self::map() as $key => $value) {
array_push($list, ['label' => $value, 'value' => $key]); array_push($list, ['label' => $value, 'value' => $key]);
} }
return $list; return $list;
} }

View File

@ -24,6 +24,7 @@ enum StoreRole: int
foreach (self::map() as $key => $value) { foreach (self::map() as $key => $value) {
array_push($list, ['label' => $value, 'value' => $key]); array_push($list, ['label' => $value, 'value' => $key]);
} }
return $list; return $list;
} }

View File

@ -2,20 +2,22 @@
namespace App\Models; namespace App\Models;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use EloquentFilter\Filterable;
use App\Casts\Storage;
class Ad extends Model class Ad extends Model
{ {
use HasFactory;
use Filterable; use Filterable;
use HasFactory;
public const TYPE_OFF = 0; //无跳转 public const TYPE_OFF = 0; //无跳转
public const TYPE_WEB = 1; //网页跳转 public const TYPE_WEB = 1; //网页跳转
public const TYPE_APP = 2; //应用跳转 public const TYPE_APP = 2; //应用跳转
public const TYPE_MINI = 3;//小程序跳转
public const TYPE_MINI = 3; //小程序跳转
protected function serializeDate(\DateTimeInterface $date) protected function serializeDate(\DateTimeInterface $date)
{ {
@ -41,7 +43,7 @@ class Ad extends Model
'jump_config', 'jump_config',
]; ];
public static function jumpTypeMap() :array public static function jumpTypeMap(): array
{ {
return [ return [
self::TYPE_WEB => '网页跳转', self::TYPE_WEB => '网页跳转',
@ -58,7 +60,7 @@ class Ad extends Model
self::TYPE_WEB => "<span class='label label-info'>网页跳转</span>", self::TYPE_WEB => "<span class='label label-info'>网页跳转</span>",
self::TYPE_APP => "<span class='label label-warning'>应用跳转</span>", self::TYPE_APP => "<span class='label label-warning'>应用跳转</span>",
self::TYPE_MINI => "<span class='label label-green'>小程序跳转</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_IN => "<span class='label label-info'>入住缴费</span>",
self::TYPE_CONTINUE => "<span class='label label-warning'>续住缴费</span>", self::TYPE_CONTINUE => "<span class='label label-warning'>续住缴费</span>",
self::TYPE_EXIT => "<span class='label label-danger'>离开结算</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()); $q->where('is_enable', true)->where('published_at', '>=', now());
} }

View File

@ -46,7 +46,7 @@ class AdminUser extends Model
} }
$parent = $allMenus->get($parent->parent_id); $parent = $allMenus->get($parent->parent_id);
}; }
} }
unset($allMenus, $roleMenus); unset($allMenus, $roleMenus);

View File

@ -2,16 +2,15 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use EloquentFilter\Filterable; 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 class Article extends Model
{ {
use HasFactory;
use Filterable; use Filterable;
use HasFactory;
protected function serializeDate(\DateTimeInterface $date) protected function serializeDate(\DateTimeInterface $date)
{ {
@ -42,7 +41,8 @@ class Article extends Model
'appendixes', 'appendixes',
]; ];
public function scopeShow(){ public function scopeShow()
{
$q->where('is_enable', true)->where('published_at', '>=', now()); $q->where('is_enable', true)->where('published_at', '>=', now());
} }
@ -54,10 +54,10 @@ class Article extends Model
->orderBy('created_at', 'desc'); ->orderBy('created_at', 'desc');
} }
protected function tags():Attribute protected function tags(): Attribute
{ {
return Attribute::make( return Attribute::make(
get: fn($value) => $this->t_ids ? explode(',', $this->t_ids) : [], get: fn ($value) => $this->t_ids ? explode(',', $this->t_ids) : [],
); );
} }
} }

View File

@ -2,12 +2,12 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Enums\EmployeeStatus; use App\Enums\EmployeeStatus;
use Slowlyo\OwlAdmin\Models\AdminUser;
use Illuminate\Database\Eloquent\Casts\Attribute;
use EloquentFilter\Filterable;
use App\Traits\HasDateTimeFormatter; use App\Traits\HasDateTimeFormatter;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
use Slowlyo\OwlAdmin\Models\AdminUser;
/** /**
* 员工 * 员工

View File

@ -11,8 +11,8 @@ use Illuminate\Support\Str;
class Keyword extends Model class Keyword extends Model
{ {
use HasFactory;
use Filterable; use Filterable;
use HasFactory;
protected $fillable = ['name', 'key', 'value', 'parent_id', 'parent_key', 'path', 'sort', 'lv']; protected $fillable = ['name', 'key', 'value', 'parent_id', 'parent_key', 'path', 'sort', 'lv'];
@ -33,7 +33,7 @@ class Keyword extends Model
'lv' => 1, 'lv' => 1,
]); ]);
if((string) $keyword->key === ''){ if ((string) $keyword->key === '') {
$keyword->key = Str::random(16); $keyword->key = Str::random(16);
} }
} else { } else {
@ -43,8 +43,8 @@ class Keyword extends Model
'lv' => $parent->lv + 1, 'lv' => $parent->lv + 1,
]); ]);
if((string) $keyword->key === ''){ if ((string) $keyword->key === '') {
$keyword->key = $parent->key . '_' . ($parent->children()->count() + 1); $keyword->key = $parent->key.'_'.($parent->children()->count() + 1);
} }
} }
}); });
@ -62,17 +62,18 @@ class Keyword extends Model
public function scopeAllChildrenOfKey($q, $parentKey) public function scopeAllChildrenOfKey($q, $parentKey)
{ {
$q->where('path','like', '%-'. $q->where('path', 'like', '%-'.
static::where('key', $parentKey)->value('id') static::where('key', $parentKey)->value('id')
. '-%' ?? ''); .'-%' ?? '');
} }
public static function tagsMap(String $key) public static function tagsMap(string $key)
{ {
$mapArr = []; $mapArr = [];
self::query()->where('parent_key', $key)->get()->map(function($item) use (&$mapArr){ self::query()->where('parent_key', $key)->get()->map(function ($item) use (&$mapArr) {
$mapArr[$item->id] = Components::make()->keywordsTag($item->name, $item->value); $mapArr[$item->id] = Components::make()->keywordsTag($item->name, $item->value);
}); });
return $mapArr; return $mapArr;
} }

View File

@ -2,11 +2,11 @@
namespace App\Models; namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Enums\BusinessStatus; use App\Enums\BusinessStatus;
use Illuminate\Database\Eloquent\Casts\Attribute;
use EloquentFilter\Filterable;
use App\Traits\HasDateTimeFormatter; use App\Traits\HasDateTimeFormatter;
use EloquentFilter\Filterable;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
/** /**
* 门店 * 门店

View File

@ -35,10 +35,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
}); });
} }
/**
* @param \Illuminate\Database\Events\QueryExecuted $query
* @return string
*/
protected function prepareSql(QueryExecuted $query): string protected function prepareSql(QueryExecuted $query): string
{ {
$sql = str_replace(['%', '?'], ['%%', '%s'], $query->sql); $sql = str_replace(['%', '?'], ['%%', '%s'], $query->sql);
@ -54,7 +50,6 @@ class QueryLoggerServiceProvider extends ServiceProvider
/** /**
* @param float $milliseconds * @param float $milliseconds
* @return string
*/ */
protected function formatDuration($milliseconds): string protected function formatDuration($milliseconds): string
{ {

View File

@ -2,23 +2,16 @@
namespace App\Traits; namespace App\Traits;
use Slowlyo\OwlAdmin\Admin;
use Slowlyo\OwlAdmin\Renderers\Drawer;
use Slowlyo\OwlAdmin\Renderers\Dialog; use Slowlyo\OwlAdmin\Renderers\Dialog;
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
use Slowlyo\OwlAdmin\Renderers\DialogAction; use Slowlyo\OwlAdmin\Renderers\DialogAction;
use Slowlyo\OwlAdmin\Renderers\Drawer;
use Slowlyo\OwlAdmin\Renderers\DrawerAction;
use Slowlyo\OwlAdmin\Renderers\LinkAction; use Slowlyo\OwlAdmin\Renderers\LinkAction;
trait CustomActionTrait 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 protected function createTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
{ {
@ -27,9 +20,9 @@ trait CustomActionTrait
$form = $this->form(false)->api($this->getStorePath())->onEvent([]); $form = $this->form(false)->api($this->getStorePath())->onEvent([]);
$drawer = Drawer::make()->title(__('admin.create'))->body($form)->closeOnOutside(); $drawer = Drawer::make()->title(__('admin.create'))->body($form)->closeOnOutside();
if($width){ if ($width) {
$drawer->width($width); $drawer->width($width);
}else{ } else {
$drawer->size($size); $drawer->size($size);
} }
$button = DrawerAction::make()->drawer($drawer); $button = DrawerAction::make()->drawer($drawer);
@ -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 protected function rowEditTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
{ {
@ -70,9 +57,9 @@ trait CustomActionTrait
$drawer = Drawer::make()->title(__('admin.edit'))->body($form)->closeOnOutside(); $drawer = Drawer::make()->title(__('admin.edit'))->body($form)->closeOnOutside();
if($width){ if ($width) {
$drawer->width($width); $drawer->width($width);
}else{ } else {
$drawer->size($size); $drawer->size($size);
} }
@ -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 protected function rowShowTypeButton(string $type = '', string $size = '', string $width = ''): DialogAction|DrawerAction|LinkAction
{ {
@ -112,15 +93,15 @@ trait CustomActionTrait
case 'drawer': case 'drawer':
$drawer = Drawer::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->closeOnOutside(); $drawer = Drawer::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->closeOnOutside();
if($width){ if ($width) {
$drawer->width($width); $drawer->width($width);
}else{ } else {
$drawer->size($size); $drawer->size($size);
} }
//补充详情操作按钮扩展 //补充详情操作按钮扩展
try{ try {
$actions = $this->detailActions(); $actions = $this->detailActions();
}catch(\BadMethodCallException $e){ } catch (\BadMethodCallException $e) {
$actions = []; $actions = [];
} }
$drawer->actions($actions); $drawer->actions($actions);
@ -130,9 +111,9 @@ trait CustomActionTrait
case 'dialog': case 'dialog':
//补充详情操作按钮扩展 //补充详情操作按钮扩展
$dialog = Dialog::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->size($size); $dialog = Dialog::make()->title(__('admin.show'))->name('detail_info')->body($this->detail('$id'))->size($size);
try{ try {
$actions = $this->detailActions(); $actions = $this->detailActions();
}catch(\BadMethodCallException $e){ } catch (\BadMethodCallException $e) {
$actions = []; $actions = [];
} }
$dialog->actions($actions); $dialog->actions($actions);

View File

@ -2,10 +2,10 @@
namespace App\Traits; namespace App\Traits;
use Slowlyo\OwlAdmin\Admin;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Slowlyo\OwlAdmin\Admin;
trait UploadTrait trait UploadTrait
{ {
@ -27,15 +27,15 @@ trait UploadTrait
$fromWangEditor = false; $fromWangEditor = false;
$file = request()->file('file'); $file = request()->file('file');
if (!$file) { if (! $file) {
$fromWangEditor = true; $fromWangEditor = true;
$file = request()->file('wangeditor-uploaded-image'); $file = request()->file('wangeditor-uploaded-image');
if (!$file) { if (! $file) {
$file = request()->file('wangeditor-uploaded-video'); $file = request()->file('wangeditor-uploaded-video');
} }
} }
if (!$file) { if (! $file) {
return $this->response()->additional(['errno' => 1])->fail(__('admin.upload_file_error')); return $this->response()->additional(['errno' => 1])->fail(__('admin.upload_file_error'));
} }
@ -57,16 +57,16 @@ trait UploadTrait
{ {
$file = request()->file('file'); $file = request()->file('file');
if (!$file) { if (! $file) {
return $this->response()->fail(__('admin.upload_file_error')); return $this->response()->fail(__('admin.upload_file_error'));
} }
$path = $file->store(Admin::config('admin.upload.tem_directory.' . $type).'/'.date('Y-m-d'), Admin::config('admin.upload.disk')); $path = $file->store(Admin::config('admin.upload.tem_directory.'.$type).'/'.date('Y-m-d'), Admin::config('admin.upload.disk'));
return $this->response()->success(['value' => $path]); return $this->response()->success(['value' => $path]);
} }
public function saveImage($field = 'image', $path) public function saveImage($field, $path)
{ {
return $this->saveFile($field, $path); return $this->saveFile($field, $path);
} }
@ -74,42 +74,42 @@ trait UploadTrait
/** /**
* 表单提交时,转存实际目录,并保留上传时文件名称;文件保存全路径 * 表单提交时,转存实际目录,并保留上传时文件名称;文件保存全路径
*/ */
public function saveFile($field = 'file', $path) public function saveFile($field, $path)
{ {
$file = request()->file($field); $file = request()->file($field);
if (!$file) { if (! $file) {
$file = request()->get($field); $file = request()->get($field);
} }
$fileArr = []; $fileArr = [];
//判断是否多个文件; //判断是否多个文件;
if(is_string($file) || isset($file['id'])){ if (is_string($file) || isset($file['id'])) {
$files = [$file]; $files = [$file];
}else{ } else {
$files = $file; $files = $file;
} }
if($files){ if ($files) {
foreach($files as $file){ foreach ($files as $file) {
if(is_array($file) && isset($file['state'])){ if (is_array($file) && isset($file['state'])) {
switch($file['state']){ switch ($file['state']) {
case 'init': case 'init':
if(strpos($file['value'], 'temporary') !== false){ if (strpos($file['value'], 'temporary') !== false) {
$filePath = $path.'/'.$file['name']; $filePath = $path.'/'.$file['name'];
Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath); Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath);
$fileArr[] = Storage::disk(Admin::config('admin.upload.disk'))->url($filePath); $fileArr[] = Storage::disk(Admin::config('admin.upload.disk'))->url($filePath);
}else{ } else {
$fileArr[] = $file['value']; $fileArr[] = $file['value'];
} }
break; break;
case 'uploaded': case 'uploaded':
if(isset($file['name'])){ if (isset($file['name'])) {
$filePath = $path.'/'.$file['name']; $filePath = $path.'/'.$file['name'];
if(Str::startsWith($file['value'], ['http://', 'https://'])){ if (Str::startsWith($file['value'], ['http://', 'https://'])) {
$fileUrl = parse_url($file['value']); $fileUrl = parse_url($file['value']);
$fileValue = ltrim($fileUrl['path'], '/'); $fileValue = ltrim($fileUrl['path'], '/');
}else{ } else {
$fileValue = $file['value']; $fileValue = $file['value'];
} }
Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath); Storage::disk(Admin::config('admin.upload.disk'))->move($file['value'], $filePath);
@ -117,11 +117,12 @@ trait UploadTrait
} }
break; break;
} }
}else{ } else {
$fileArr[] = $file; $fileArr[] = $file;
} }
} }
} }
return $fileArr; return $fileArr;
} }
@ -135,8 +136,8 @@ trait UploadTrait
$uploadId = md5(time().$fileName); $uploadId = md5(time().$fileName);
//创建临时文件夹 //创建临时文件夹
if ( Storage::disk(Admin::config('admin.upload.disk'))->exists(Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId) === false ) { if (Storage::disk(Admin::config('admin.upload.disk'))->exists(Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId) === false) {
if ( Storage::disk(Admin::config('admin.upload.disk'))->makeDirectory(Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId) === false ) { if (Storage::disk(Admin::config('admin.upload.disk'))->makeDirectory(Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId) === false) {
return false; return false;
} }
} }
@ -159,14 +160,15 @@ trait UploadTrait
$fileName = $file->getClientOriginalName(); $fileName = $file->getClientOriginalName();
//判断该分片是否已存在, //判断该分片是否已存在,
$dirPath = Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId; $dirPath = Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId;
if(Storage::disk(Admin::config('admin.upload.disk'))->exists($dirPath . '/'.$fileName.'_'.$partNumber)){ if (Storage::disk(Admin::config('admin.upload.disk'))->exists($dirPath.'/'.$fileName.'_'.$partNumber)) {
return $this->response()->fail(__('admin.upload_file_error')); return $this->response()->fail(__('admin.upload_file_error'));
}else{ } else {
//验证分片大小-todo //验证分片大小-todo
$path = $file->storeAs($dirPath, $fileName.'_'.$partNumber, Admin::config('admin.upload.disk')); $path = $file->storeAs($dirPath, $fileName.'_'.$partNumber, Admin::config('admin.upload.disk'));
$realPath = Storage::disk(Admin::config('admin.upload.disk'))->url($path); $realPath = Storage::disk(Admin::config('admin.upload.disk'))->url($path);
$eTag = md5_file($realPath); $eTag = md5_file($realPath);
return $this->response()->success(['eTag' => $eTag]); return $this->response()->success(['eTag' => $eTag]);
} }
} }
@ -182,18 +184,18 @@ trait UploadTrait
$uploadId = request()->get('uploadId', ''); $uploadId = request()->get('uploadId', '');
$partList = request()->get('partList', []); $partList = request()->get('partList', []);
$basePath = Admin::config('admin.upload.tem_directory.' . $type).'/'.$uploadId; $basePath = Admin::config('admin.upload.tem_directory.'.$type).'/'.$uploadId;
$realPath = 'chunk/'.$fileName; $realPath = 'chunk/'.$fileName;
//获取分片列表中序号,查看分片是否都完成上传 //获取分片列表中序号,查看分片是否都完成上传
$partNumberList = Arr::pluck($partList, 'partNumber'); $partNumberList = Arr::pluck($partList, 'partNumber');
if(max($partNumberList) === count($partNumberList)){ if (max($partNumberList) === count($partNumberList)) {
//判断是否已存在同名文件,进行删除 //判断是否已存在同名文件,进行删除
if(Storage::disk(Admin::config('admin.upload.disk'))->exists($realPath)){ if (Storage::disk(Admin::config('admin.upload.disk'))->exists($realPath)) {
$realPath = 'chunk/(1)'.$fileName; $realPath = 'chunk/(1)'.$fileName;
} }
for($i = 1; $i<=count($partNumberList); $i++){ for ($i = 1; $i <= count($partNumberList); $i++) {
$_file = Storage::disk(Admin::config('admin.upload.disk'))->get($basePath.'/'.$fileName.'_'.$i); $_file = Storage::disk(Admin::config('admin.upload.disk'))->get($basePath.'/'.$fileName.'_'.$i);
Storage::disk(Admin::config('admin.upload.disk'))->append($realPath, $_file, null); Storage::disk(Admin::config('admin.upload.disk'))->append($realPath, $_file, null);
} }
@ -202,8 +204,8 @@ trait UploadTrait
$value = Storage::disk(Admin::config('admin.upload.disk'))->url($realPath); $value = Storage::disk(Admin::config('admin.upload.disk'))->url($realPath);
return $this->response()->success(['value'=>$value]); return $this->response()->success(['value' => $value]);
}else{ } else {
return $this->response()->fail(__('admin.upload_file_error')); return $this->response()->fail(__('admin.upload_file_error'));
} }
} }

View File

@ -54,7 +54,7 @@ return [
], ],
'upload' => [ 'upload' => [
'disk' => env("FILESYSTEM_DISK", 'public'), 'disk' => env('FILESYSTEM_DISK', 'public'),
// 文件上传目录 // 文件上传目录
'directory' => [ 'directory' => [
'image' => 'images', 'image' => 'images',

View File

@ -56,21 +56,21 @@ return [
'throw' => false, 'throw' => false,
], ],
"oss" => [ 'oss' => [
"driver" => "oss", 'driver' => 'oss',
"access_key_id" => env("OSS_ACCESS_KEY_ID"), // 必填, 阿里云的AccessKeyId 'access_key_id' => env('OSS_ACCESS_KEY_ID'), // 必填, 阿里云的AccessKeyId
"access_key_secret" => env("OSS_ACCESS_KEY_SECRET"), // 必填, 阿里云的AccessKeySecret 'access_key_secret' => env('OSS_ACCESS_KEY_SECRET'), // 必填, 阿里云的AccessKeySecret
"bucket" => env("OSS_BUCKET"), // 必填, 对象存储的Bucket, 示例: my-bucket 'bucket' => env('OSS_BUCKET'), // 必填, 对象存储的Bucket, 示例: my-bucket
"endpoint" => env("OSS_ENDPOINT"), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com 'endpoint' => env('OSS_ENDPOINT'), // 必填, 对象存储的Endpoint, 示例: oss-cn-shanghai.aliyuncs.com
"internal" => env("OSS_INTERNAL", null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com 'internal' => env('OSS_INTERNAL', null), // 选填, 内网上传地址,填写即启用 示例: oss-cn-shanghai-internal.aliyuncs.com
"domain" => env("OSS_DOMAIN", null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com 'domain' => env('OSS_DOMAIN', null), // 选填, 绑定域名,填写即启用 示例: oss.my-domain.com
"is_cname" => env("OSS_CNAME", false), // 选填, 若Endpoint为自定义域名此项要为truehttps://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78 'is_cname' => env('OSS_CNAME', false), // 选填, 若Endpoint为自定义域名此项要为truehttps://github.com/aliyun/aliyun-oss-php-sdk/blob/572d0f8e099e8630ae7139ed3fdedb926c7a760f/src/OSS/OssClient.php#L113C1-L122C78
"prefix" => env("OSS_PREFIX", ""), // 选填, 统一存储地址前缀 'prefix' => env('OSS_PREFIX', ''), // 选填, 统一存储地址前缀
"use_ssl" => env("OSS_SSL", false), // 选填, 是否使用HTTPS 'use_ssl' => env('OSS_SSL', false), // 选填, 是否使用HTTPS
"reverse_proxy" => env("OSS_REVERSE_PROXY", false), // 选填, 域名是否使用NGINX代理绑定 'reverse_proxy' => env('OSS_REVERSE_PROXY', false), // 选填, 域名是否使用NGINX代理绑定
"throw" => env("OSS_THROW", true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false 'throw' => env('OSS_THROW', true), // 选填, 是否抛出引起错误的异常,默认出现错误时,不抛出异常仅返回false
"options" => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false] 'options' => [], // 选填, 添加全局配置参数, 示例: [\OSS\OssClient::OSS_CHECK_MD5 => false]
"macros" => [] // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class] 'macros' => [], // 选填, 添加自定义Macro, 示例: [\App\Macros\ListBuckets::class, \App\Macros\CreateBucket::class]
], ],
], ],

View File

@ -2,10 +2,9 @@
namespace Database\Seeders; namespace Database\Seeders;
use Slowlyo\OwlAdmin\Models\AdminMenu;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str; use Slowlyo\OwlAdmin\Models\AdminMenu;
use Throwable; use Throwable;
class AdminMenuSeeder extends Seeder class AdminMenuSeeder extends Seeder
@ -19,23 +18,23 @@ class AdminMenuSeeder extends Seeder
{ {
// //
$menus = [ $menus = [
['title' => 'index', 'icon' => 'line-md:home-twotone-alt', 'url' => '/index', 'is_home'=>1, 'order'=>1], ['title' => 'index', 'icon' => 'line-md:home-twotone-alt', 'url' => '/index', 'is_home' => 1, 'order' => 1],
['title' => 'admin_system', 'icon' => 'material-symbols:settings-outline', 'url' => '/system', 'order'=>2, ['title' => 'admin_system', 'icon' => 'material-symbols:settings-outline', 'url' => '/system', 'order' => 2,
'children' => [ 'children' => [
['title' => 'admin_users', 'icon' => 'ph:user-gear', 'url' => '/system/admin_users', 'order'=>1], ['title' => 'admin_users', 'icon' => 'ph:user-gear', 'url' => '/system/admin_users', 'order' => 1],
['title' => 'admin_roles', 'icon' => 'carbon:user-role', 'url' => '/system/admin_roles', 'order'=>2], ['title' => 'admin_roles', 'icon' => 'carbon:user-role', 'url' => '/system/admin_roles', 'order' => 2],
['title' => 'admin_permission', 'icon' => 'carbon:user-role', 'url' => '/system/admin_permissions', 'order'=>3], ['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_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' => '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],
], ],
], ],
['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(); DB::table('admin_menus')->truncate();
try { try {

View File

@ -121,7 +121,7 @@ class AdminPermissionSeeder extends Seeder
{ {
foreach ($data as $slug => $node) { foreach ($data as $slug => $node) {
$permission = AdminPermission::updateOrCreate([ $permission = AdminPermission::updateOrCreate([
'slug' => ($parent->slug ?? 'admin') . '.' . $slug, 'slug' => ($parent->slug ?? 'admin').'.'.$slug,
], [ ], [
'parent_id' => $parent->id ?? 0, 'parent_id' => $parent->id ?? 0,
'name' => is_array($node) ? $node['name'] : $node, 'name' => is_array($node) ? $node['name'] : $node,
@ -143,7 +143,7 @@ class AdminPermissionSeeder extends Seeder
foreach ($resourceAbilities as $resourceAbility) { foreach ($resourceAbilities as $resourceAbility) {
AdminPermission::updateOrCreate([ AdminPermission::updateOrCreate([
'slug' => $permission->slug . '.' . $resourceAbility, 'slug' => $permission->slug.'.'.$resourceAbility,
], [ ], [
'parent_id' => $permission->id, 'parent_id' => $permission->id,
'name' => $this->resourceAbilityMap()[$resourceAbility], 'name' => $this->resourceAbilityMap()[$resourceAbility],

View File

@ -34,7 +34,7 @@ class KeywordSeeder extends Seeder
[ [
'key' => 'job', 'key' => 'job',
'name' => '职位', 'name' => '职位',
'children' => ['普通员工', '小组长', '主管'] 'children' => ['普通员工', '小组长', '主管'],
], ],
[ [
'key' => 'store_category', 'key' => 'store_category',
@ -54,7 +54,7 @@ class KeywordSeeder extends Seeder
['name' => '电脑整机'], ['name' => '电脑整机'],
['name' => '外设产品'], ['name' => '外设产品'],
['name' => '网络产品'], ['name' => '网络产品'],
]] ]],
], ],
], ],
[ [
@ -86,7 +86,7 @@ class KeywordSeeder extends Seeder
$item['sort'] = $i + 1; $item['sort'] = $i + 1;
} }
$key = Arr::pull($item, 'key', $parent?->key . '_' . ($i + 1)); $key = Arr::pull($item, 'key', $parent?->key.'_'.($i + 1));
/** @var \App\Models\Keyword */ /** @var \App\Models\Keyword */
$keyword = Keyword::updateOrCreate( $keyword = Keyword::updateOrCreate(

View File

@ -129,7 +129,7 @@ return [
'fill' => '填充', 'fill' => '填充',
'save_current_config' => '保存当前配置', 'save_current_config' => '保存当前配置',
'input_config_name' => '请填写配置名称', 'input_config_name' => '请填写配置名称',
'same_name_tips' => '相同名称的配置将会被覆盖' 'same_name_tips' => '相同名称的配置将会被覆盖',
], ],
'admin_users' => '管理员', 'admin_users' => '管理员',