feat: 新增登录接口
This commit is contained in:
43
app/admin/model/v1/UserModel.php
Normal file
43
app/admin/model/v1/UserModel.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model\v1;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class UserModel extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'sys_user';
|
||||
|
||||
// 主键
|
||||
protected $pk = 'id';
|
||||
|
||||
// 隐藏字段
|
||||
protected $hidden = ['password', 'salt'];
|
||||
|
||||
// 字段信息
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'username' => 'string',
|
||||
'password' => 'string',
|
||||
'salt' => 'string',
|
||||
'role_id' => 'int',
|
||||
'nickname' => 'string',
|
||||
'avatar' => 'string',
|
||||
'mobile' => 'string',
|
||||
'email' => 'string',
|
||||
'status' => 'int',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
] ;
|
||||
|
||||
// 用户名查询范围
|
||||
public function scopeUsernameOrMobile($query, $username)
|
||||
{
|
||||
return $query->where('username', '=', $username)->whereOr('mobile', '=', $username);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user