From efde8a41b24d59f5f2c1a6ac718b356294bd80f8 Mon Sep 17 00:00:00 2001 From: ai567 <978713427@qq.com> Date: Fri, 29 Nov 2024 09:12:59 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dtp=E5=92=8Cla?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E7=9A=84=E5=9B=9E=E6=94=B6=E7=AB=99model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/la/system/SystemRecycleBin.php | 22 ++++++++++++++++++++++ app/model/tp/system/SystemRecycleBin.php | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 app/model/la/system/SystemRecycleBin.php create mode 100644 app/model/tp/system/SystemRecycleBin.php diff --git a/app/model/la/system/SystemRecycleBin.php b/app/model/la/system/SystemRecycleBin.php new file mode 100644 index 0000000..3a2ee76 --- /dev/null +++ b/app/model/la/system/SystemRecycleBin.php @@ -0,0 +1,22 @@ +hasOne(SystemUser::class, 'id', 'operate_id')->bind(['operate_name' => 'real_name']); + } +} diff --git a/app/model/tp/system/SystemRecycleBin.php b/app/model/tp/system/SystemRecycleBin.php new file mode 100644 index 0000000..331a934 --- /dev/null +++ b/app/model/tp/system/SystemRecycleBin.php @@ -0,0 +1,22 @@ +hasOne(SystemUser::class, 'id', 'operate_id')->bind(['operate_name' => 'real_name']); + } +} -- Gitee From 9ad205e2ebe22ccfd09f2905664186e2ab820f5b Mon Sep 17 00:00:00 2001 From: ai567 <978713427@qq.com> Date: Fri, 29 Nov 2024 09:25:45 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dtp=E5=92=8Cla?= =?UTF-8?q?=E7=BC=BA=E5=B0=91=E7=9A=84=E5=9B=9E=E6=94=B6=E7=AB=99model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/la/system/SystemRecycleBin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/model/la/system/SystemRecycleBin.php b/app/model/la/system/SystemRecycleBin.php index 3a2ee76..31c7e0e 100644 --- a/app/model/la/system/SystemRecycleBin.php +++ b/app/model/la/system/SystemRecycleBin.php @@ -13,7 +13,7 @@ class SystemRecycleBin extends BaseLaORMModel */ protected $pk = 'id'; - protected $name = 'system_recycle_bin'; + protected $table = 'system_recycle_bin'; public function operate():\Illuminate\Database\Eloquent\Relations\HasOne { -- Gitee From f46c27b154d37d59da11c238ed5ee159c6769132 Mon Sep 17 00:00:00 2001 From: ai567 <978713427@qq.com> Date: Fri, 29 Nov 2024 10:26:08 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dtp=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/system/SystemCrontabLogService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/services/system/SystemCrontabLogService.php b/app/services/system/SystemCrontabLogService.php index 1412318..bd922e1 100644 --- a/app/services/system/SystemCrontabLogService.php +++ b/app/services/system/SystemCrontabLogService.php @@ -18,6 +18,10 @@ use support\Container; class SystemCrontabLogService extends BaseService { + /** + * @var SystemCrontabLogDao $dao + */ + public $dao; public function __construct() { $this->dao = Container::make(SystemCrontabLogDao::class); -- Gitee From 962efa5f150e4ab097fefdecb6dc307b2821b1d1 Mon Sep 17 00:00:00 2001 From: ai567 <978713427@qq.com> Date: Fri, 29 Nov 2024 11:42:05 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dla=E5=9B=9E=E6=94=B6?= =?UTF-8?q?=E7=AB=99=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/la/system/SystemRecycleBin.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/model/la/system/SystemRecycleBin.php b/app/model/la/system/SystemRecycleBin.php index 31c7e0e..e312c4b 100644 --- a/app/model/la/system/SystemRecycleBin.php +++ b/app/model/la/system/SystemRecycleBin.php @@ -15,8 +15,20 @@ class SystemRecycleBin extends BaseLaORMModel protected $table = 'system_recycle_bin'; + protected $appends = ['operate_name']; + + /** + * 定义访问器 + * + * @return null + */ + public function getOperateNameAttribute(): mixed + { + return $this->operate ? $this->operate->real_name : null; + } + public function operate():\Illuminate\Database\Eloquent\Relations\HasOne { - return $this->hasOne(SystemUser::class, 'id', 'operate_id')->bind(['operate_name' => 'real_name']); + return $this->hasOne(SystemUser::class, 'id', 'operate_id')->select(['id', 'real_name']); } } -- Gitee From 329bd5046742987f0dabafd71023c5a207648db3 Mon Sep 17 00:00:00 2001 From: ai567 <978713427@qq.com> Date: Fri, 29 Nov 2024 11:42:39 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dla=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E8=8F=9C=E5=8D=95=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/la/system/SystemMenu.php | 22 +++++++++++++++------- app/services/system/SystemAuthService.php | 6 +----- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/model/la/system/SystemMenu.php b/app/model/la/system/SystemMenu.php index f94d136..6dbf3f1 100644 --- a/app/model/la/system/SystemMenu.php +++ b/app/model/la/system/SystemMenu.php @@ -12,6 +12,7 @@ namespace app\model\la\system; +use Illuminate\Database\Eloquent\Casts\Attribute; use madong\basic\BaseLaORMModel; /** @@ -27,6 +28,7 @@ class SystemMenu extends BaseLaORMModel protected $primaryKey = 'id'; + protected $appends=['name','meta']; /** * 菜单meta属性 * @@ -34,39 +36,45 @@ class SystemMenu extends BaseLaORMModel * * @return array */ - public static function getMetaAttribute($data): array + public function getMetaAttribute() { // 1.构建mate数组 $newData = [ - 'icon' => $data['icon'] ?? '', - 'title' => $data['title'] ?? '', + 'icon' => $this['icon'] ?? '', + 'title' => $this['title'] ?? '', 'menuVisibleWithForbidden' => true, ]; // 2.添加fixed锁定菜单标记 - if (isset($data['is_affix']) && ($data['is_affix'] === 1 || $data['is_affix'] === '1')) { + if (isset($this['is_affix']) && ($this['is_affix'] === 1 || $this['is_affix'] === '1')) { $newData['order'] = -1; $newData['affixTab'] = true; } // 3.是否隐藏菜单 - if (isset($data['is_show']) && $data['is_show'] == 0) { + if (isset($this['is_show']) && $this['is_show'] == 0) { $newData['hideInMenu'] = true; } // 4.是否缓存 - if (isset($data['is_cache']) && $data['is_cache'] == 1) { + if (isset($this['is_cache']) && $this['is_cache'] == 1) { $newData['keepAlive'] = true; } //5.是否外链在新窗口打开 - if (isset($data['open_type']) && $data['open_type'] == 1) { + if (isset($this['open_type']) && $this['open_type'] == 1) { $newData['link'] = true; } // 更多参数可以在这边添加 + return $newData; } + public function getNameAttribute() + { + return $this->code; + } + /** * Id搜索 */ diff --git a/app/services/system/SystemAuthService.php b/app/services/system/SystemAuthService.php index 56af90d..9694058 100644 --- a/app/services/system/SystemAuthService.php +++ b/app/services/system/SystemAuthService.php @@ -131,16 +131,12 @@ class SystemAuthService extends BaseService $list = $systemMenuService->dao->selectList($where, '*', 0, 0, 'sort asc', [], true); //兼容LaORM if ($list instanceof \Illuminate\Database\Eloquent\Collection) { - foreach ($list as $item) { - $item->set('name', $item->code); - $item->set('meta', LaSystemMenu::getMetaAttribute($item)); - } $list->makeVisible(['id', 'pid', 'type', 'sort', 'redirect', 'path', 'name', 'meta', 'component']); } else { //默认tp模型 foreach ($list as $item) { $item->set('name', $item->getData('code')); - $item->set('meta', TpSystemMenu::getMetaAttribute($item)); + $item->set('meta', $item->meta); } $list->visible(['id', 'pid', 'type', 'sort', 'redirect', 'path', 'name', 'meta', 'component']); } -- Gitee