feat: 重构注单控制器以复用共享筛选逻辑

新增 TicketItemListFilters trait,用于封装注单列表的通用筛选逻辑。
更新 AdminPlayerTicketItemsIndexController、AdminTicketItemIndexController 与 TicketItemsIndexController,统一使用新的注单编号搜索与订单日期范围筛选方法,提升代码复用性与可读性。
增强 AdminRiskPoolManualStatusController:支持发布手动停售状态变更通知。
优化 RiskPoolService 与 TicketWalletService:钱包资金变动后实时通知余额更新。
更新测试用例,确保重构后功能行为保持一致。
This commit is contained in:
2026-05-26 17:14:19 +08:00
parent 36e50383ba
commit 618201f980
12 changed files with 408 additions and 84 deletions

View File

@@ -8,9 +8,13 @@ use App\Lottery\ErrorCode;
use App\Models\TicketOrder;
use App\Models\PlayerWallet;
use App\Exceptions\TicketOperationException;
use App\Services\Wallet\WalletBalanceRealtimeNotifier;
final class TicketWalletService
{
public function __construct(
private readonly WalletBalanceRealtimeNotifier $balanceRealtime,
) {}
private const TXN_POSTED = 'posted';
private const TXN_DIR_OUT = 2;
@@ -71,6 +75,9 @@ final class TicketWalletService
'remark' => null,
]);
$wallet->refresh();
$this->balanceRealtime->notifyAfterMovement($wallet, -$amountMinor, 'bet_deduct');
return $after;
}
@@ -119,6 +126,9 @@ final class TicketWalletService
'idempotent_key' => $idempotentKey,
'remark' => 'post_deduct_confirmation_failed',
]);
$wallet->refresh();
$this->balanceRealtime->notifyAfterMovement($wallet, $amount, 'bet_reverse');
}
/**
@@ -187,6 +197,9 @@ final class TicketWalletService
'idempotent_key' => $idempotentKey,
'remark' => 'manual_jackpot_burst',
]);
$wallet->refresh();
$this->balanceRealtime->notifyAfterMovement($wallet, $amountMinor, 'jackpot_manual_payout');
}
public function creditSettlementPayout(Player $player, string $currencyCode, int $amountMinor, int $settlementBatchId): void
@@ -243,6 +256,9 @@ final class TicketWalletService
'idempotent_key' => $idempotentKey,
'remark' => null,
]);
$wallet->refresh();
$this->balanceRealtime->notifyAfterMovement($wallet, $amountMinor, 'settle_payout');
}
private function newTxnNo(): string