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

@@ -1,13 +1,14 @@
<?php
use App\Events\DrawCountdownBroadcast;
use App\Events\DrawStatusChangeBroadcast;
use App\Lottery\DrawResultBatchStatus;
use App\Lottery\DrawStatus;
use App\Models\AdminUser;
use App\Models\Draw;
use App\Models\DrawResultBatch;
use App\Events\DrawCountdownBroadcast;
use App\Events\DrawStatusChangeBroadcast;
use App\Models\DrawResultItem;
use App\Models\SettlementBatch;
use App\Services\Draw\DrawPlannerService;
use App\Services\Draw\DrawTickService;
use Carbon\Carbon;
@@ -199,7 +200,9 @@ test('cooldown expiry tick moves draw to settling', function (): void {
app(DrawTickService::class)->tick(now()->utc());
$draw->refresh();
expect($draw->status)->toBe(DrawStatus::Settling->value);
expect($draw->status)->toBe(DrawStatus::Settled->value);
expect((int) $draw->settle_version)->toBe(1);
expect(SettlementBatch::query()->where('draw_id', $draw->id)->where('status', 'completed')->count())->toBe(1);
Carbon::setTestNow();
});