更新细节

This commit is contained in:
yaooo 2023-11-21 11:36:22 +08:00
parent b452fc4ffe
commit 43adfeba19
3 changed files with 9 additions and 4 deletions

View File

@ -16,6 +16,7 @@ class SystemLogic extends BaseLogic
'url' => $params['url'], 'url' => $params['url'],
'app_id' => create_app_id(), 'app_id' => create_app_id(),
'app_key' => create_app_key(), 'app_key' => create_app_key(),
'register_status' => $params['register_status'],
'status' => 0, 'status' => 0,
]); ]);
return true; return true;
@ -50,6 +51,7 @@ class SystemLogic extends BaseLogic
'name' => $params['name'], 'name' => $params['name'],
'url' => $params['url'], 'url' => $params['url'],
'status' => $params['status'], 'status' => $params['status'],
'register_status' => $params['register_status'],
'update_time' => time() 'update_time' => time()
]); ]);
return true; return true;
@ -62,7 +64,7 @@ class SystemLogic extends BaseLogic
// 查看 // 查看
public static function detail($params) : array 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; $data['status_text'] = $data->status_text;
return $data->toArray(); return $data->toArray();
} }

View File

@ -19,7 +19,7 @@ class UserLogic extends BaseLogic
$user = User::field($field)->where(['id' => $userId])->findOrEmpty(); $user = User::field($field)->where(['id' => $userId])->findOrEmpty();
$user['gender_text'] = $user->gender_text; $user['gender_text'] = $user->gender_text;
$user['status_text'] = $user->status_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(); return $user->toArray();
} }

View File

@ -16,6 +16,7 @@ class SystemValidate extends BaseValidate
'name' => 'require|unique:system', 'name' => 'require|unique:system',
'url' => 'require|uri|unique:system', 'url' => 'require|uri|unique:system',
'status' => 'require|in:0,1', 'status' => 'require|in:0,1',
'register_status' => 'require|in:0,1',
]; ];
protected $message = [ protected $message = [
@ -27,16 +28,18 @@ class SystemValidate extends BaseValidate
'url.unique' => '系统网址已被使用', 'url.unique' => '系统网址已被使用',
'status.require' => '请选择系统状态', 'status.require' => '请选择系统状态',
'status.in' => '系统状态值错误', 'status.in' => '系统状态值错误',
'register_status.require' => '请选择系统注册状态',
'register_status.in' => '系统注册状态值错误',
]; ];
public function sceneAdd(): SystemValidate public function sceneAdd(): SystemValidate
{ {
return $this->only(['name','url']); return $this->only(['name','url', 'register_status']);
} }
public function sceneEdit(): SystemValidate public function sceneEdit(): SystemValidate
{ {
return $this->only(['id','name','url','status']); return $this->only(['id','name','url','status','register_status']);
} }
public function sceneDetail(): SystemValidate public function sceneDetail(): SystemValidate