Browse Source

接口重置密码影响到管理员

lizhen_gitee 1 year ago
parent
commit
193858d505
1 changed files with 13 additions and 0 deletions
  1. 13 0
      application/common/library/Authcompany.php

+ 13 - 0
application/common/library/Authcompany.php

@@ -222,6 +222,19 @@ class Authcompany
 
         Tokencompany::delete($this->_token);
 
+        //同步到admin
+        $admin = [
+            'password' => $newpassword,
+            'salt'     => $salt,
+            'updatetime' => time(),
+        ];
+        $admin_rs = Db::name('admin')->where('staff_id',$this->_user->id)->update($admin);
+        if($admin_rs === false){
+            Db::rollback();
+            $this->setError('重置失败');
+            return false;
+        }
+
         Db::commit();
 
         return true;