feat(risk): 支持按开注商隔离风险池并新增经营报表
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user