feat: 添加结算功能,更新 TicketItem 模型以支持最新结算详情,增强 DrawTickService 以自动处理结算,更新 TicketWalletService 以支持派彩入账,扩展 API 路由以管理结算批次和奖池

This commit is contained in:
2026-05-11 15:34:34 +08:00
parent 6a55fa9592
commit 19003f5041
50 changed files with 3604 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Services\Settlement;
use App\Models\TicketItem;
use App\Services\LotterySettings;
/**
* 派彩侧「回水再扣」开关(默认关:实扣已在下注阶段处理;与 PRD 一致时可打开)。
*/
final class SettlementPayoutAdjuster
{
public function adjustGrossWin(int $grossWin, TicketItem $item): int
{
if ($grossWin <= 0) {
return 0;
}
if (! (bool) LotterySettings::get('settlement.apply_rebate_to_payout', false)) {
return $grossWin;
}
$rebate = (float) $item->rebate_rate_snapshot;
return (int) floor($grossWin * max(0.0, 1.0 - $rebate));
}
}