feat(draw): 支持多玩法provider及本地化结算时区功能
- Draw相关控制器添加provider_code和provider_name字段支持 - 允许手动录入开奖批次时指定provider_code - RNG开奖批次生成支持多provider,分别生成对应批次数据 - DrawPublishService和DrawManualResultService中支持基于provider_code管理开奖版本和发布流程 - DrawResultViewService调整,支持按provider汇总及筛选开奖结果 - Settlement处理逻辑调整,按provider区分待结算票据及批次,分开结算 - 结算期间管理相关服务支持使用站点本地结算时区计算开账建议和日期处理 - 增加AdminSite的settlement_timezone字段及相关请求验证和数据存取支持 - 优化AdminSettlementPeriod相关代码,防止存在未结清票据时关账 - Ticket明细返回接口添加结算时区信息,提升用户时间体验 - 多处查询排序和版本号处理改进,保证多provider数据正确顺序与一致性
This commit is contained in:
@@ -397,6 +397,54 @@ test('period close succeeds with no share ledger rows in window', function (): v
|
||||
->toBe(0);
|
||||
});
|
||||
|
||||
test('period close fails when tickets in the window are still unsettled', function (): void {
|
||||
['site_id' => $siteId, 'site_code' => $siteCode, 'root_id' => $rootId] = createSiteWithRoot('unsettled-close');
|
||||
|
||||
$player = Player::query()->create([
|
||||
'site_code' => $siteCode,
|
||||
'agent_node_id' => $rootId,
|
||||
'site_player_id' => 'p-unsettled-close',
|
||||
'username' => 'unsettled_close',
|
||||
'nickname' => null,
|
||||
'default_currency' => 'NPR',
|
||||
'funding_mode' => 'credit',
|
||||
'auth_source' => 'lottery_native',
|
||||
'status' => 1,
|
||||
]);
|
||||
|
||||
$ticketItemId = createTicketItemForPlayer($player, 'UNSETTLED-CLOSE');
|
||||
DB::table('ticket_items')->where('id', $ticketItemId)->update([
|
||||
'status' => 'pending_draw',
|
||||
'settled_at' => null,
|
||||
'agent_settled_at' => null,
|
||||
'created_at' => '2026-06-03 12:00:00',
|
||||
'updated_at' => '2026-06-03 12:00:00',
|
||||
]);
|
||||
|
||||
$periodId = (int) DB::table('settlement_periods')->insertGetId([
|
||||
'admin_site_id' => $siteId,
|
||||
'period_start' => '2026-06-01 00:00:00',
|
||||
'period_end' => '2026-06-07 23:59:59',
|
||||
'status' => 'open',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
$caught = null;
|
||||
try {
|
||||
app(AgentSettlementPeriodCloseService::class)->closePeriod($periodId);
|
||||
} catch (\Illuminate\Validation\ValidationException $e) {
|
||||
$caught = $e;
|
||||
}
|
||||
|
||||
expect($caught)->toBeInstanceOf(\Illuminate\Validation\ValidationException::class);
|
||||
expect($caught?->errors()['period'][0] ?? null)->toBe('period_has_unsettled_tickets');
|
||||
expect((string) DB::table('settlement_periods')->where('id', $periodId)->value('status'))
|
||||
->toBe('open');
|
||||
expect(DB::table('settlement_bills')->where('settlement_period_id', $periodId)->count())
|
||||
->toBe(0);
|
||||
});
|
||||
|
||||
test('period close does not dispatch rebates from other sites', function (): void {
|
||||
$siteA = createSiteWithRoot('rebate-site-a');
|
||||
$siteB = createSiteWithRoot('rebate-site-b');
|
||||
|
||||
Reference in New Issue
Block a user