feat(credit): 实时同步代理已用额度,覆盖玩家下注/结算全流程
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
lotterLaravel E2E / e2e-api (push) Has been cancelled

- PlayerCreditService 在下注占用、输赢结算、撤单释放等关键节点触发 AgentUsedCreditSyncService
- AgentProfileService::present 与 AgentDashboardOverviewBuilder 查询前主动同步 used_credit
- 确保代理链 used_credit(团队已用风险)实时反映下级玩家信用占用状态
This commit is contained in:
2026-06-30 15:15:15 +08:00
parent 200269196e
commit f1f68d09d3
6 changed files with 390 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ final class AgentProfileService
private readonly CreditAllocationValidator $creditAllocationValidator,
private readonly RebateLimitValidator $rebateLimitValidator,
private readonly AgentCreditAllocatedSyncService $allocatedSync,
private readonly AgentUsedCreditSyncService $usedCreditSync,
) {}
/**
@@ -132,6 +133,7 @@ final class AgentProfileService
public function present(AgentProfile $profile): array
{
$this->allocatedSync->syncForAgentId((int) $profile->agent_node_id);
$this->usedCreditSync->syncForAgentId((int) $profile->agent_node_id);
$profile->refresh();
$available = max(0, (int) $profile->credit_limit - (int) $profile->allocated_credit);