1
0

first commit

This commit is contained in:
2020-08-06 14:58:51 +08:00
commit 17096657dc
780 changed files with 92857 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\common\model;
use think\Config as Conf;
use think\Request;
use tools\Crypt;
class Member extends _Init
{
protected $readonly = [''];
/**
* 模型初始化【事件注册】
*/
protected static function init()
{
self::beforeInsert(function ($data) {
$data->reg_ip = Request::instance()->ip();
});
}
/**
* 格式化 最后登录时间
* @param [type] $value 最后登录时间 时间戳
*/
protected function getLastTimeAttr($value)
{
return date(Conf::get('database.datetime_format'), $value);
}
/**
* 加密密码
* @param [type] $value [description]
*/
protected function setPasswordAttr($value)
{
return Crypt::uMd5($value);
}
/**
* 用户资料
*/
protected function info()
{
return $this->hasOne('MemberInfo', 'uid', 'id');
}
/**
* 关联 AuthUser 表
* @return [type] [description]
*/
public function authUser()
{
return $this->hasOne('AuthUser', 'uid', 'id');
}
public function getJuniorAttr($value, $data)
{
return MemberList::where('uid', $data['id'])->count();
}
}