Admin.php 750 B

12345678910111213141516171819202122232425262728293031323334
  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. }