feat: 扩展奖池、风控与报表能力,新增对账补偿、广播和人工操作接口

This commit is contained in:
2026-05-18 15:09:10 +08:00
parent 9157dcb6a1
commit 6ef41cee76
46 changed files with 1889 additions and 98 deletions

View File

@@ -59,15 +59,13 @@ final class RiskCapStreamService
]);
}
} else {
foreach (['0000', '1234', '9999'] as $num) {
RiskCapItem::query()->create([
'version_id' => $draft->id,
'draw_id' => null,
'normalized_number' => $num,
'cap_amount' => 50_000_000_000,
'cap_type' => 'per_number',
]);
}
RiskCapItem::query()->create([
'version_id' => $draft->id,
'draw_id' => null,
'normalized_number' => '0000',
'cap_amount' => 50_000_000_000,
'cap_type' => 'default',
]);
}
return $draft->fresh(['items']);
@@ -179,7 +177,10 @@ final class RiskCapStreamService
$normalizedNumber = (string) $row->normalized_number;
$capAmount = (int) $row->cap_amount;
$drawId = $row->draw_id === null ? '__null__' : (string) $row->draw_id;
$key = $drawId.'|'.$normalizedNumber;
$capType = (string) $row->cap_type;
$key = $capType === 'default'
? 'default|'.$drawId
: $drawId.'|'.$normalizedNumber;
if (! preg_match('/^[0-9]{4}$/', $normalizedNumber)) {
$errors["items.$index.normalized_number"][] = '号码必须是 4 位数字';
@@ -189,6 +190,10 @@ final class RiskCapStreamService
$errors["items.$index.cap_amount"][] = '封顶金额必须大于 0';
}
if ($capType === 'default' && $row->draw_id !== null) {
$errors["items.$index.cap_type"][] = '默认封顶不能绑定具体期号';
}
if (isset($seenKeys[$key])) {
$errors["items.$index"][] = '同一期号与号码存在重复封顶配置';
}