修复用户账号及密码修改的取值问题

This commit is contained in:
邹景立 2024-12-29 18:18:32 +08:00
parent a85cdf49d8
commit f5cced1d7a

View File

@ -79,12 +79,11 @@ class Index extends Controller
/** /**
* 修改用户资料 * 修改用户资料
* @login true * @login true
* @param mixed $id 用户ID
*/ */
public function info($id = 0) public function info()
{ {
$this->_applyFormToken(); $id = $this->request->param('id');
if (AdminService::getUserId() === intval($id)) { if (AdminService::getUserId() == intval($id)) {
SystemUser::mForm('user/form', 'id', [], ['id' => $id]); SystemUser::mForm('user/form', 'id', [], ['id' => $id]);
} else { } else {
$this->error('只能修改自己的资料!'); $this->error('只能修改自己的资料!');
@ -116,14 +115,13 @@ class Index extends Controller
/** /**
* 修改当前用户密码 * 修改当前用户密码
* @login true * @login true
* @param mixed $id
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function pass($id = 0) public function pass()
{ {
$this->_applyFormToken(); $id = $this->request->param('id');
if (AdminService::getUserId() !== intval($id)) { if (AdminService::getUserId() !== intval($id)) {
$this->error('禁止修改他人密码!'); $this->error('禁止修改他人密码!');
} }