Files
zzp-server/app/adminapi/lists/user/UserGroupRuleLists.php
2026-01-19 14:19:22 +08:00

64 lines
1.5 KiB
PHP

<?php
namespace app\adminapi\lists\user;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\user\UserGroupRule;
use app\common\lists\ListsSearchInterface;
/**
* 分组规则列表
* Class UserGroupRuleLists
* @package app\adminapi\listsuser
*/
class UserGroupRuleLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author BD
* @date 2024/04/25 01:30
*/
public function setSearch(): array
{
return [
'=' => ['group_id'],
];
}
/**
* @notes 获取分组规则列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author BD
* @date 2024/04/25 01:30
*/
public function lists(): array
{
return UserGroupRule::where($this->searchWhere)
->field(['id', 'group_id', 'num', 'money_type', 'money', 'money_percentage', 'commission_type', 'commission', 'commission_percentage'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取分组规则数量
* @return int
* @author BD
* @date 2024/04/25 01:30
*/
public function count(): int
{
return UserGroupRule::where($this->searchWhere)->count();
}
}