feat: enhance player authentication and agent management features
Some checks failed
lotterLaravel CI / test (push) Has been cancelled

- Updated AGENTS.md to clarify player interface bindings and agent account restrictions.
- Improved PlayerAuthLoginController to include captcha verification for player login.
- Enhanced AdminPlayerIndexController with permission checks for admin users.
- Refactored AdminPlayerStoreController to enforce agent node restrictions for non-super admins.
- Introduced new error codes for player authentication failures and updated related services.
- Enhanced validation rules for agent profiles to include settlement cycle options.
- Improved AdminCaptchaService to support separate scopes for admin and player captcha handling.
- Updated various services to ensure proper credit management and settlement processes.
This commit is contained in:
2026-06-17 15:27:00 +08:00
parent b496a9457c
commit 2e0b257160
49 changed files with 714 additions and 334 deletions

View File

@@ -203,39 +203,30 @@ final class AdminPlayerStoreController extends Controller
private function resolveAgentNodeIdForNonSuperAdmin(AdminUser $admin, mixed $requested, string $siteCode): ?int
{
// Check if admin is a platform account (bound via admin_user_site_roles)
$accessibleSiteIds = $admin->accessibleAdminSiteIds();
if ($accessibleSiteIds !== null) {
// Platform account (site admin) can specify agent_node_id
if ($requested !== null && (int) $requested > 0) {
$agent = AgentNode::query()->find((int) $requested);
if ($agent !== null && in_array((int) $agent->admin_site_id, $accessibleSiteIds, true)) {
return (int) $requested;
}
}
// Default to root node of the site
$siteId = AdminSite::query()->where('code', $siteCode)->value('id');
if ($siteId !== null && in_array((int) $siteId, $accessibleSiteIds, true)) {
$rootId = AgentNode::query()
->where('admin_site_id', (int) $siteId)
->where('depth', 0)
->value('id');
return $rootId !== null ? (int) $rootId : null;
}
return null;
}
// Agent account (bound via agent node) - can only create under own node
$agent = AdminAgentScope::primaryAgentNode($admin);
if ($agent === null) {
if ($agent !== null) {
if ($requested !== null && (int) $requested > 0 && (int) $requested !== (int) $agent->id) {
return null;
}
return (int) $agent->id;
}
if (! AdminAgentScope::isSiteOnlyOperator($admin)) {
return null;
}
if ($requested !== null && (int) $requested > 0 && (int) $requested !== (int) $agent->id) {
return null; // Agent account cannot create under other nodes
if ($requested === null || (int) $requested <= 0) {
return null;
}
return (int) $agent->id;
$accessibleSiteIds = $admin->accessibleAdminSiteIds() ?? [];
$node = AgentNode::query()->find((int) $requested);
if ($node === null || ! in_array((int) $node->admin_site_id, $accessibleSiteIds, true)) {
return null;
}
return (int) $requested;
}
private function generateNativeSitePlayerId(string $siteCode): string