feat: add AgentNodeIndexController for node listing and remove settlement_cycle field from AgentProfile logic

This commit is contained in:
2026-06-11 18:01:58 +08:00
parent 4d1c2b3d63
commit e14b7b4569
30 changed files with 383 additions and 91 deletions

View File

@@ -30,7 +30,6 @@ final class AgentNodeService
* credit_limit?: int,
* rebate_limit?: float|int,
* default_player_rebate?: float|int,
* settlement_cycle?: string,
* can_grant_extra_rebate?: bool,
* can_create_child_agent?: bool,
* can_create_player?: bool
@@ -125,7 +124,6 @@ final class AgentNodeService
'credit_limit' => (int) ($payload['credit_limit'] ?? 0),
'rebate_limit' => (float) ($payload['rebate_limit'] ?? 0),
'default_player_rebate' => (float) ($payload['default_player_rebate'] ?? 0),
'settlement_cycle' => (string) ($payload['settlement_cycle'] ?? 'weekly'),
'can_grant_extra_rebate' => (bool) ($payload['can_grant_extra_rebate'] ?? false),
'can_create_child_agent' => (bool) ($payload['can_create_child_agent'] ?? false),
'can_create_player' => (bool) ($payload['can_create_player'] ?? true),

View File

@@ -7,7 +7,6 @@ use App\Models\AgentNode;
use App\Models\AgentProfile;
use App\Support\AdminAgentScope;
use App\Support\AgentOverdueGuard;
use App\Support\AgentSettlementCycle;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\ValidationException;
@@ -86,9 +85,6 @@ final class AgentProfileService
'credit_limit' => $creditLimit,
'rebate_limit' => $rebateLimit,
'default_player_rebate' => $defaultRebate,
'settlement_cycle' => AgentSettlementCycle::normalize(
$payload['settlement_cycle'] ?? $profile->settlement_cycle ?? 'weekly',
),
'can_grant_extra_rebate' => (bool) ($payload['can_grant_extra_rebate'] ?? $profile->can_grant_extra_rebate ?? false),
'can_create_child_agent' => (bool) ($payload['can_create_child_agent'] ?? ($isNew ? false : $profile->can_create_child_agent)),
'can_create_player' => (bool) ($payload['can_create_player'] ?? ($isNew ? true : $profile->can_create_player ?? true)),
@@ -126,7 +122,6 @@ final class AgentProfileService
'available_credit' => $available,
'rebate_limit' => round((float) $profile->rebate_limit * 100, 4),
'default_player_rebate' => round((float) $profile->default_player_rebate * 100, 4),
'settlement_cycle' => AgentSettlementCycle::normalize($profile->settlement_cycle),
'can_grant_extra_rebate' => (bool) $profile->can_grant_extra_rebate,
'can_create_child_agent' => (bool) $profile->can_create_child_agent,
'can_create_player' => (bool) $profile->can_create_player,

View File

@@ -105,7 +105,6 @@ final class AgentSiteProvisioningService
'credit_limit' => (int) ($payload['credit_limit'] ?? $defaults['credit_limit'] ?? 0),
'rebate_limit' => (float) ($payload['rebate_limit'] ?? $defaults['rebate_limit'] ?? 0),
'default_player_rebate' => (float) ($payload['default_player_rebate'] ?? $defaults['default_player_rebate'] ?? 0),
'settlement_cycle' => (string) ($payload['settlement_cycle'] ?? $defaults['settlement_cycle'] ?? 'weekly'),
'can_grant_extra_rebate' => (bool) ($payload['can_grant_extra_rebate'] ?? true),
'can_create_child_agent' => (bool) ($payload['can_create_child_agent'] ?? true),
'can_create_player' => (bool) ($payload['can_create_player'] ?? true),

View File

@@ -15,6 +15,7 @@ final class RebateLimitValidator
return;
}
// Both $rebateRate and $profile->rebate_limit are ratios (0-1)
$limit = (float) $profile->rebate_limit;
if ($rebateRate > $limit) {
throw ValidationException::withMessages([