diff --git a/app/controller/User.php b/app/controller/User.php index cde4168..2f98dcd 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -30,7 +30,7 @@ class User extends BaseController $userModel = new UserModel(); - $user = $userModel->modifyPassword($data); + $user = $userModel->modifyPassword($data,$this->request->userInfo['id']); if ($user['status']) { return $this->renderSuccess('修改成功'); diff --git a/app/model/User.php b/app/model/User.php index 44153e1..00547b0 100644 --- a/app/model/User.php +++ b/app/model/User.php @@ -125,9 +125,9 @@ class User extends Model * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ - public function modifyPassword($data) + public function modifyPassword($data,$user_id) { - $user = $this->request->userInfo; + $user = ['id' => $user_id]; if ($user) {