feat: 增强环境配置与开发服务,支持局域网访问及币种管理

This commit is contained in:
2026-05-21 16:24:41 +08:00
parent 699d43fbd4
commit 7a6048de10
60 changed files with 1321 additions and 443 deletions

View File

@@ -7,14 +7,16 @@ use App\Models\SettlementBatch;
final class SettlementBatchFinancialSummary
{
/**
* @return array{total_bet_amount: int, total_actual_deduct: int, platform_profit: int}
* @return array{total_bet_amount: int, total_actual_deduct: int, platform_profit: int, currency_code: ?string}
*/
public static function forBatch(SettlementBatch $batch): array
{
$totals = $batch->details()
->join('ticket_items', 'ticket_items.id', '=', 'ticket_settlement_details.ticket_item_id')
->join('ticket_orders', 'ticket_orders.id', '=', 'ticket_items.order_id')
->selectRaw('COALESCE(SUM(ticket_items.total_bet_amount), 0) as total_bet_amount')
->selectRaw('COALESCE(SUM(ticket_items.actual_deduct_amount), 0) as total_actual_deduct')
->selectRaw('MIN(ticket_orders.currency_code) as currency_code')
->first();
$totalBet = (int) ($totals?->total_bet_amount ?? 0);
@@ -25,6 +27,9 @@ final class SettlementBatchFinancialSummary
'total_bet_amount' => $totalBet,
'total_actual_deduct' => $totalActualDeduct,
'platform_profit' => $totalActualDeduct - $totalPayout,
'currency_code' => is_string($totals?->currency_code) && $totals->currency_code !== ''
? $totals->currency_code
: null,
];
}
}