refactor: 修改model

This commit is contained in:
2025-01-13 09:28:15 +08:00
parent f82ac85b46
commit 2e3eba644e
15 changed files with 231 additions and 143 deletions

View File

@@ -3,38 +3,16 @@ declare (strict_types = 1);
namespace app\admin\model\v1;
use think\Model;
use app\common\model\UserBaseModel;
/**
* @mixin \think\Model
*/
class UserModel extends Model
class UserModel extends UserBaseModel
{
// 表名
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)
{