mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-24 10:20:16 +08:00
26 lines
579 B
PHP
26 lines
579 B
PHP
<?php
|
|
namespace app\admin\model;
|
|
|
|
use think\Model;
|
|
|
|
class User extends Model {
|
|
|
|
protected $autoWriteTimestamp = true;
|
|
protected $insert = ['regIp'];
|
|
protected $createTime = 'regTime';
|
|
protected $updateTime = 'updateTime';
|
|
|
|
protected function setRegIpAttr(){
|
|
return request()->ip(1);
|
|
}
|
|
|
|
protected function setPasswordAttr($value) {
|
|
return $this->getPwdHash($value);
|
|
}
|
|
|
|
public function getPwdHash( $pwd ){
|
|
$hashKey = config('auth_key');
|
|
$newPwd = $pwd.$hashKey;
|
|
return md5(sha1($newPwd).$hashKey);
|
|
}
|
|
} |