[游戏管理]用户管理

This commit is contained in:
2026-04-15 10:19:30 +08:00
parent 66c14eacb3
commit 7b002c9410
11 changed files with 386 additions and 28 deletions

View File

@@ -21,7 +21,7 @@ class User extends Backend
protected array|string $preExcludeFields = ['id', 'uuid', 'create_time', 'update_time'];
protected array $withJoinTable = ['gameChannel', 'admin'];
protected array $withJoinTable = ['channel', 'admin'];
protected string|array $quickSearchField = ['id', 'username', 'phone'];
@@ -53,7 +53,7 @@ class User extends Backend
$data['password'] = hash_password($password);
$username = $data['username'] ?? '';
$channelId = $data['channel_id'] ?? ($data['game_channel_id'] ?? null);
$channelId = $data['channel_id'] ?? null;
if (!is_string($username) || trim($username) === '' || $channelId === null || $channelId === '') {
return $this->error(__('Parameter %s can not be empty', ['username/channel_id']));
}
@@ -131,10 +131,8 @@ class User extends Backend
$nextChannelId = null;
if (array_key_exists('channel_id', $data)) {
$nextChannelId = $data['channel_id'];
} elseif (array_key_exists('game_channel_id', $data)) {
$nextChannelId = $data['game_channel_id'];
} else {
$nextChannelId = $row['channel_id'] ?? $row['game_channel_id'] ?? null;
$nextChannelId = $row['channel_id'] ?? null;
}
if (is_string($nextUsername) && trim($nextUsername) !== '' && $nextChannelId !== null && $nextChannelId !== '') {
@@ -194,7 +192,7 @@ class User extends Backend
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with($this->withJoinTable)
->visible(['gameChannel' => ['name'], 'admin' => ['username']])
->visible(['channel' => ['name'], 'admin' => ['username']])
->alias($alias)
->where($where)
->order($order)