feat: 增强代理结算和账单管理功能

- 在多个控制器中引入 SettlementPartyEnrichment 服务,以优化代理结算和账单的处理逻辑。
- 更新 AgentSettlementBillIndexController 和 AgentSettlementBillShowController,支持根据账单 ID 和关键字进行查询。
- 在 AgentSettlementPeriodCloseController 中添加对站点管理权限的验证,确保只有具备相应权限的管理员能够关闭账期。
- 在 AgentSettlementPeriodIndexController 中更新账期数据的返回格式,提升数据的完整性和可用性。
- 引入对相对占成比例的支持,增强代理资料的管理能力,确保数据一致性。
This commit is contained in:
2026-06-05 18:00:56 +08:00
parent a44679665d
commit 2d32f006c5
63 changed files with 4893 additions and 288 deletions

View File

@@ -3,14 +3,12 @@
namespace App\Services\AgentSettlement;
use App\Models\AgentNode;
use App\Models\Player;
use Illuminate\Support\Facades\DB;
final class AgentPeriodAggregator
{
public function __construct(
private readonly ShareSettlementCalculator $calculator,
private readonly BetSettlementSnapshotBuilder $snapshotBuilder,
) {}
/**
@@ -54,15 +52,9 @@ final class AgentPeriodAggregator
$playerId = (int) $row->player_id;
$snapshot = $this->resolveSnapshotFromLedgerRow($row);
if ($snapshot === null) {
$player = Player::query()->find($playerId);
if ($player === null) {
continue;
}
$built = $this->snapshotBuilder->buildForPlayer($player);
$snapshot = [
'total_shares' => $built['total_shares'],
'chain_codes' => $built['chain_codes'],
];
throw new \InvalidArgumentException(
'share_snapshot_missing:ticket_item_id='.(int) $row->ticket_item_id,
);
}
$gameWinLoss = (int) $row->game_win_loss;