You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

35 lines
750 B

  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. use think\Session;
  5. class Admin extends Model
  6. {
  7. // 开启自动写入时间戳字段
  8. protected $autoWriteTimestamp = 'int';
  9. // 定义时间戳字段名
  10. protected $createTime = 'createtime';
  11. protected $updateTime = 'updatetime';
  12. /**
  13. * 重置用户密码
  14. * @author baiyouwen
  15. */
  16. public function resetPassword($uid, $NewPassword)
  17. {
  18. $passwd = $this->encryptPassword($NewPassword);
  19. $ret = $this->where(['id' => $uid])->update(['password' => $passwd]);
  20. return $ret;
  21. }
  22. // 密码加密
  23. protected function encryptPassword($password, $salt = '', $encrypt = 'md5')
  24. {
  25. return $encrypt($password . $salt);
  26. }
  27. }