feat: 增强奖池与钱包管理功能

更新 AdminJackpotPoolUpdateController 校验规则,禁止传入 current_amount。
优化 AdminRiskPoolManualStatusController:更新奖池状态后同步 Redis 状态。
在 TransferOrderReconcileController 中新增 completeCredit 方法,用于处理卡住的转账订单对账。
调整 TransferOrderListController:优化转账订单处理条件。
在 TicketItemsIndexController 中实现支持时区的日期筛选,提升日期处理准确性。
扩展 JackpotPool 模型,新增 adjustments 关联关系。
改进票据与钱包相关服务中的错误处理和事务管理。
This commit is contained in:
2026-05-26 14:58:41 +08:00
parent 48349e3302
commit c8c90e3e94
45 changed files with 1877 additions and 104 deletions

View File

@@ -159,6 +159,7 @@ test('admin transfer order list exposes available reconcile actions by status',
->and($byNo['TI_failed']['can_manually_process'])->toBeTrue()
->and($byNo['TI_wait']['can_reverse'])->toBeTrue()
->and($byNo['TI_wait']['can_manually_process'])->toBeTrue()
->and($byNo['TI_wait']['can_complete_credit'])->toBeFalse()
->and($byNo['TI_done']['can_reverse'])->toBeFalse()
->and($byNo['TI_done']['can_manually_process'])->toBeFalse();
});
@@ -326,6 +327,56 @@ test('admin transfer reverse is idempotent under concurrent reconcile', function
->and(WalletTxn::query()->where('biz_type', 'reversal')->count())->toBe(1);
});
test('admin can complete stuck transfer in credit for pending reconcile order', function (): void {
$token = makeAdminToken();
$player = Player::query()->create([
'site_code' => 'main',
'site_player_id' => 'complete-credit-player',
'username' => null,
'nickname' => null,
'default_currency' => 'NPR',
'status' => 0,
]);
$wallet = PlayerWallet::query()->create([
'player_id' => $player->id,
'wallet_type' => 'lottery',
'currency_code' => 'NPR',
'balance' => 500,
'frozen_balance' => 0,
'status' => 0,
'version' => 0,
]);
TransferOrder::query()->create([
'transfer_no' => 'TI_complete_credit',
'player_id' => $player->id,
'direction' => 'in',
'currency_code' => 'NPR',
'amount' => 2_000,
'idempotent_key' => 'complete-credit-key',
'status' => 'pending_reconcile',
'external_request_payload' => ['ok' => true],
'external_response_payload' => ['ok' => true],
'external_ref_no' => 'main-ref-1',
'fail_reason' => 'lottery_credit_failed',
'finished_at' => null,
]);
$this->withHeader('Authorization', 'Bearer '.$token)
->postJson('/api/v1/admin/wallet/transfer-orders/TI_complete_credit/complete-credit', [
'remark' => 'manual complete',
])
->assertOk()
->assertJsonPath('data.status', 'success');
$wallet->refresh();
expect((int) $wallet->balance)->toBe(2_500)
->and(TransferOrder::query()->where('transfer_no', 'TI_complete_credit')->value('status'))->toBe('success')
->and(WalletTxn::query()->where('biz_type', 'transfer_in')->count())->toBe(1);
});
test('admin shows player wallets', function (): void {
$token = makeAdminToken();