feat(risk): 支持按开注商隔离风险池并新增经营报表
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
lotterLaravel E2E / e2e-api (push) Has been cancelled

This commit is contained in:
2026-07-10 10:23:30 +08:00
parent d4779660c8
commit 2ea3e810a0
31 changed files with 610 additions and 58 deletions

View File

@@ -151,16 +151,21 @@ final class PlayCatalogResolver
return collect(array_values($selected));
}
public function resolveCapAmount(int $drawId, string $number4d): int
public function resolveCapAmount(int $drawId, string $number4d, ?string $providerCode = null): int
{
$riskVersion = RiskCapVersion::query()
->where('status', ConfigVersionStatus::Active->value)
->firstOrFail();
$providerCode = strtoupper(trim((string) ($providerCode ?: 'GLOBAL')));
$providerScopes = array_values(array_unique(['GLOBAL', $providerCode]));
$specific = RiskCapItem::query()
->where('version_id', $riskVersion->id)
->whereIn('provider_code', $providerScopes)
->where('draw_id', $drawId)
->where('normalized_number', $number4d)
->orderByRaw('case when provider_code = ? then 0 else 1 end', [$providerCode])
->orderByDesc('id')
->first();
@@ -170,8 +175,10 @@ final class PlayCatalogResolver
$generic = RiskCapItem::query()
->where('version_id', $riskVersion->id)
->whereIn('provider_code', $providerScopes)
->whereNull('draw_id')
->where('normalized_number', $number4d)
->orderByRaw('case when provider_code = ? then 0 else 1 end', [$providerCode])
->orderByDesc('id')
->first();
@@ -181,8 +188,10 @@ final class PlayCatalogResolver
$default = RiskCapItem::query()
->where('version_id', $riskVersion->id)
->whereIn('provider_code', $providerScopes)
->whereNull('draw_id')
->where('cap_type', 'default')
->orderByRaw('case when provider_code = ? then 0 else 1 end', [$providerCode])
->orderByDesc('id')
->first();