From 43adfeba1964134cd20c1a40577ea624edcb93c2 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Tue, 21 Nov 2023 11:36:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/adminapi/logic/systems/SystemLogic.php | 4 +++- app/adminapi/logic/user/UserLogic.php | 2 +- app/common/validate/systems/SystemValidate.php | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/adminapi/logic/systems/SystemLogic.php b/app/adminapi/logic/systems/SystemLogic.php index da52f149..2c2a05d7 100644 --- a/app/adminapi/logic/systems/SystemLogic.php +++ b/app/adminapi/logic/systems/SystemLogic.php @@ -16,6 +16,7 @@ class SystemLogic extends BaseLogic 'url' => $params['url'], 'app_id' => create_app_id(), 'app_key' => create_app_key(), + 'register_status' => $params['register_status'], 'status' => 0, ]); return true; @@ -50,6 +51,7 @@ class SystemLogic extends BaseLogic 'name' => $params['name'], 'url' => $params['url'], 'status' => $params['status'], + 'register_status' => $params['register_status'], 'update_time' => time() ]); return true; @@ -62,7 +64,7 @@ class SystemLogic extends BaseLogic // 查看 public static function detail($params) : array { - $data = System::field('id,name,app_id,app_key,url,status,create_time')->findOrEmpty($params['id']); + $data = System::field('id,name,app_id,app_key,url,register_status,status,create_time')->findOrEmpty($params['id']); $data['status_text'] = $data->status_text; return $data->toArray(); } diff --git a/app/adminapi/logic/user/UserLogic.php b/app/adminapi/logic/user/UserLogic.php index 0cefca61..62ed758d 100644 --- a/app/adminapi/logic/user/UserLogic.php +++ b/app/adminapi/logic/user/UserLogic.php @@ -19,7 +19,7 @@ class UserLogic extends BaseLogic $user = User::field($field)->where(['id' => $userId])->findOrEmpty(); $user['gender_text'] = $user->gender_text; $user['status_text'] = $user->status_text; - $user['app_list'] = Db::name('system_user')->alias('su')->leftJoin('dc_system s','su.app_id = s.app_id')->field(['s.id', 's.app_id', 's.name'])->select(); + $user['app_list'] = Db::name('system_user')->alias('su')->leftJoin('dc_system s','su.app_id = s.app_id')->where('su.user_id', $userId)->field(['s.id', 's.app_id', 's.name'])->select(); return $user->toArray(); } diff --git a/app/common/validate/systems/SystemValidate.php b/app/common/validate/systems/SystemValidate.php index 423e4594..fb111994 100644 --- a/app/common/validate/systems/SystemValidate.php +++ b/app/common/validate/systems/SystemValidate.php @@ -16,6 +16,7 @@ class SystemValidate extends BaseValidate 'name' => 'require|unique:system', 'url' => 'require|uri|unique:system', 'status' => 'require|in:0,1', + 'register_status' => 'require|in:0,1', ]; protected $message = [ @@ -27,16 +28,18 @@ class SystemValidate extends BaseValidate 'url.unique' => '系统网址已被使用', 'status.require' => '请选择系统状态', 'status.in' => '系统状态值错误', + 'register_status.require' => '请选择系统注册状态', + 'register_status.in' => '系统注册状态值错误', ]; public function sceneAdd(): SystemValidate { - return $this->only(['name','url']); + return $this->only(['name','url', 'register_status']); } public function sceneEdit(): SystemValidate { - return $this->only(['id','name','url','status']); + return $this->only(['id','name','url','status','register_status']); } public function sceneDetail(): SystemValidate