schema = [ 'id' => 'number', 'account' => 'string', 'nickname' => 'string', 'password' => 'string', 'token' => 'string', 'delete_time' => 'number', 'create_time' => 'number', 'update_time' => 'number' ]; } public function access() { return self::hasOne(AuthGroupAccessModel::class,'admin_id','id'); } public function loadByLogin($username, $password) { return $this->where([ ['account|id', '=', $username], ['password', '=', $password], ['is_delete', '=',0] ])->find(); } public function refreshToken($adminId,$token) { return $this->where([ ['id', '=',$adminId], ['is_delete', '=',0] ])->update(['token' => $token]); } /** * @return \think\Paginator * @throws \think\db\exception\DbException */ public function findByPaginate() { return $this->where('is_delete',0)->with(['access','access.group'])->paginate(10); } public function doesItExist($account) { $customer = $this->where([ ["account", '=',$account], ["is_delete", '=', 0], ])->find(); return $customer; } public function findById($id) { return $this->where('id',$id)->with(['access','access.group'])->find(); } }