| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
- // +----------------------------------------------------------------------
- // | likeadmin快速开发前后端分离管理后台(PHP版)
- // +----------------------------------------------------------------------
- // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
- // | 开源版本可自由商用,可去除界面版权logo
- // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
- // | github下载:https://github.com/likeshop-github/likeadmin
- // | 访问官网:https://www.likeadmin.cn
- // | likeadmin团队 版权所有 拥有最终解释权
- // +----------------------------------------------------------------------
- // | author: likeadminTeam
- // +----------------------------------------------------------------------
- namespace app\adminapi\lists\tenant;
- use app\common\model\auth\TenantAdmin;
- use app\tenantapi\lists\BaseAdminDataLists;
- use app\common\enum\user\UserTerminalEnum;
- use app\common\lists\ListsExcelInterface;
- use app\common\model\tenant\Tenant;
- /**
- * 用户列表
- * Class TenantLists
- * @package app\tenantapi\lists\user
- */
- class TenantAdminLists extends BaseAdminDataLists implements ListsExcelInterface
- {
- /**
- * @notes 搜索条件
- * @return array
- * @author 段誉
- * @date 2022/9/22 15:50
- */
- public function setSearch(): array
- {
- $allowSearch = ['keyword', 'create_time_start', 'create_time_end','tenant_id'];
- return array_intersect(array_keys($this->params), $allowSearch);
- }
- /**
- * @notes 获取用户列表
- * @return array
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author 段誉
- * @date 2022/9/22 15:50
- */
- public function lists(): array
- {
- //进行参数校验 租户标识必填
- if(!isset($this->params['tenant_id'])){
- return [];
- }
- $field = "id,root,name,avatar,account,multipoint_login,disable,create_time";
- $lists = TenantAdmin::withSearch($this->setSearch(), $this->params)
- ->limit($this->limitOffset, $this->limitLength)
- ->field($field)
- ->order('create_time desc')
- ->select()->toArray();
- return $lists;
- }
- /**
- * @notes 获取数量
- * @return int
- * @author 段誉
- * @date 2022/9/22 15:51
- */
- public function count(): int
- {
- return TenantAdmin::withSearch($this->setSearch(), $this->params)->count();
- }
- /**
- * @notes 导出文件名
- * @return string
- * @author 段誉
- * @date 2022/11/24 16:17
- */
- public function setFileName(): string
- {
- return '租户用户列表';
- }
- /**
- * @notes 导出字段
- * @return string[]
- * @author 段誉
- * @date 2022/11/24 16:17
- */
- public function setExcelFields(): array
- {
- return [
- 'root' => '是否超级管理员',
- 'name' => '租户账户昵称',
- 'avatar' => '头像',
- 'account' => '账号',
- 'multipoint_login' => '是否允许多处登录',
- 'disable' => '是否禁用',
- 'create_time' => '注册时间',
- ];
- }
- }
|