deploy: auto commit repo-root changes 2026-06-13 12:42:06

This commit is contained in:
hajimi
2026-06-13 12:42:06 +08:00
parent ed1733e49d
commit 127475e539
2 changed files with 92 additions and 2 deletions
+22 -2
View File
@@ -17,6 +17,7 @@ use app\adminapi\lists\BaseAdminDataLists;
use app\common\enum\user\UserTerminalEnum;
use app\common\lists\ListsExcelInterface;
use app\common\model\user\User;
use app\common\service\user\UserAccountTypeService;
/**
@@ -36,6 +37,9 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
public function setSearch(): array
{
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end'];
if (($this->params['account_scope'] ?? '') === UserAccountTypeService::SCOPE_SYSTEM) {
$allowSearch = array_diff($allowSearch, ['channel']);
}
return array_intersect(array_keys($this->params), $allowSearch);
}
@@ -52,13 +56,15 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
public function lists(): array
{
$field = "id,sn,nickname,sex,avatar,account,mobile,channel,user_money,user_points,create_time";
$lists = User::withSearch($this->setSearch(), $this->params)
$lists = $this->buildQuery()
->limit($this->limitOffset, $this->limitLength)
->field($field)
->order('id desc')
->select()->toArray();
foreach ($lists as &$item) {
$accountType = UserAccountTypeService::resolveType($item);
$item = array_merge($item, $accountType);
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
}
@@ -74,7 +80,7 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
*/
public function count(): int
{
return User::withSearch($this->setSearch(), $this->params)->count();
return $this->buildQuery()->count();
}
@@ -103,9 +109,23 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
'nickname' => '用户昵称',
'account' => '账号',
'mobile' => '手机号码',
'account_scope_desc' => '账号归属',
'account_type_desc' => '账号类型',
'channel' => '注册来源',
'create_time' => '注册时间',
];
}
protected function buildQuery()
{
$query = User::withSearch($this->setSearch(), $this->params);
$accountScope = (string) ($this->params['account_scope'] ?? '');
if ($accountScope === UserAccountTypeService::SCOPE_REGISTERED) {
$query->whereIn('channel', UserAccountTypeService::registeredChannels());
} elseif ($accountScope === UserAccountTypeService::SCOPE_SYSTEM) {
$query->whereNotIn('channel', UserAccountTypeService::registeredChannels());
}
return $query;
}
}