feat: enhance agent management and validation logic
- Updated AGENTS.md to clarify agent account restrictions and permissions. - Implemented checks in AgentNodeAdminUserStoreController and AgentNodeRoleStoreController to restrict admin user and role creation to the agent's own node. - Enhanced validation in AdminPlayerStoreController and AdminPlayerUpdateController to enforce credit limit and rebate rate rules based on player funding mode. - Refactored various request classes to utilize shared admin account field rules for consistency. - Improved error handling in services related to credit allocation and rebate limits to ensure proper validation and messaging.
This commit is contained in:
@@ -25,15 +25,7 @@ final class PlayerNativeAuthService
|
||||
);
|
||||
}
|
||||
|
||||
if ($siteCode === '') {
|
||||
$siteCode = trim((string) config('lottery.integration.default_site_code', ''));
|
||||
}
|
||||
|
||||
$player = Player::query()
|
||||
->where('site_code', $siteCode)
|
||||
->where('username', $username)
|
||||
->where('auth_source', PlayerAuthSource::LOTTERY_NATIVE)
|
||||
->first();
|
||||
$player = $this->resolveNativePlayer($siteCode, $username);
|
||||
|
||||
if ($player === null || ! is_string($player->password_hash) || $player->password_hash === '') {
|
||||
throw new PlayerAuthenticationException(
|
||||
@@ -132,4 +124,29 @@ final class PlayerNativeAuthService
|
||||
|
||||
$player->forceFill($updates)->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* 彩票端登录:玩家只填账号密码,不传站点编号。
|
||||
* 若请求带了 site_code(部署绑站)则优先在该站查找;否则按账号全局匹配唯一彩票原生玩家。
|
||||
*/
|
||||
private function resolveNativePlayer(string $siteCode, string $username): ?Player
|
||||
{
|
||||
$query = Player::query()
|
||||
->where('username', $username)
|
||||
->where('auth_source', PlayerAuthSource::LOTTERY_NATIVE);
|
||||
|
||||
if ($siteCode !== '') {
|
||||
$scoped = (clone $query)->where('site_code', $siteCode)->first();
|
||||
if ($scoped !== null) {
|
||||
return $scoped;
|
||||
}
|
||||
}
|
||||
|
||||
$candidates = $query->get();
|
||||
if ($candidates->count() === 1) {
|
||||
return $candidates->first();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user