feat(credit): 实时同步代理已用额度,覆盖玩家下注/结算全流程
- PlayerCreditService 在下注占用、输赢结算、撤单释放等关键节点触发 AgentUsedCreditSyncService - AgentProfileService::present 与 AgentDashboardOverviewBuilder 查询前主动同步 used_credit - 确保代理链 used_credit(团队已用风险)实时反映下级玩家信用占用状态
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user