<?php
|
|
namespace app\operations\model\auth;
|
|
use app\common\model\plus\operations\User as UserModel;
|
use app\common\model\plus\operations\UserRole as UserRoleModel;
|
|
/**
|
* 区域代理用户模型
|
*/
|
class User extends UserModel
|
{
|
/**
|
* 获取管理员列表
|
*/
|
public function getList($limit = 20)
|
{
|
return $this->with(['roles.role'])->where('is_delete', '=', 0)
|
->order(['create_time' => 'desc'])
|
->paginate($limit);
|
}
|
|
/**
|
* 检查用户名是否已存在
|
*/
|
public function getUserName($where, $operations_user_id = 0)
|
{
|
if ($operations_user_id > 0) {
|
return $this->where($where)->where('operations_user_id', '<>', $operations_user_id)->count();
|
}
|
return $this->where($where)->count();
|
}
|
|
/**
|
* 删除管理员
|
*/
|
public function del($where)
|
{
|
self::update(['is_delete' => 1], $where);
|
return UserRoleModel::where('operations_user_id', $where['operations_user_id'])->delete();
|
}
|
}
|