Browse Source

不使用session 切换jwt数据2

master
wanghongjun 2 years ago
parent
commit
b63702fec3
  1. 2
      app/controller/User.php
  2. 4
      app/model/User.php

2
app/controller/User.php

@ -30,7 +30,7 @@ class User extends BaseController
$userModel = new UserModel(); $userModel = new UserModel();
$user = $userModel->modifyPassword($data); $user = $userModel->modifyPassword($data,$this->request->userInfo['id']);
if ($user['status']) { if ($user['status']) {
return $this->renderSuccess('修改成功'); return $this->renderSuccess('修改成功');

4
app/model/User.php

@ -125,9 +125,9 @@ class User extends Model
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @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) { if ($user) {

Loading…
Cancel
Save