fix: 统一注单待开奖状态并收敛报表任务返回字段
This commit is contained in:
@@ -31,10 +31,7 @@ final class ReportJobIndexController extends Controller
|
|||||||
'admin_user_id' => $j->admin_user_id !== null ? (int) $j->admin_user_id : null,
|
'admin_user_id' => $j->admin_user_id !== null ? (int) $j->admin_user_id : null,
|
||||||
'report_type' => $j->report_type,
|
'report_type' => $j->report_type,
|
||||||
'export_format' => $j->export_format,
|
'export_format' => $j->export_format,
|
||||||
'filter_json' => $j->filter_json,
|
|
||||||
'status' => $j->status,
|
'status' => $j->status,
|
||||||
'output_path' => $j->output_path,
|
|
||||||
'error_message' => $j->error_message,
|
|
||||||
'finished_at' => $j->finished_at?->toIso8601String(),
|
'finished_at' => $j->finished_at?->toIso8601String(),
|
||||||
'created_at' => $j->created_at?->toIso8601String(),
|
'created_at' => $j->created_at?->toIso8601String(),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -18,10 +18,7 @@ final class ReportJobShowController extends Controller
|
|||||||
'admin_user_id' => $report_job->admin_user_id !== null ? (int) $report_job->admin_user_id : null,
|
'admin_user_id' => $report_job->admin_user_id !== null ? (int) $report_job->admin_user_id : null,
|
||||||
'report_type' => $report_job->report_type,
|
'report_type' => $report_job->report_type,
|
||||||
'export_format' => $report_job->export_format,
|
'export_format' => $report_job->export_format,
|
||||||
'filter_json' => $report_job->filter_json,
|
|
||||||
'status' => $report_job->status,
|
'status' => $report_job->status,
|
||||||
'output_path' => $report_job->output_path,
|
|
||||||
'error_message' => $report_job->error_message,
|
|
||||||
'finished_at' => $report_job->finished_at?->toIso8601String(),
|
'finished_at' => $report_job->finished_at?->toIso8601String(),
|
||||||
'created_at' => $report_job->created_at?->toIso8601String(),
|
'created_at' => $report_job->created_at?->toIso8601String(),
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ final class ReportJobStoreController extends Controller
|
|||||||
'report_type' => $job->report_type,
|
'report_type' => $job->report_type,
|
||||||
'export_format' => $job->export_format,
|
'export_format' => $job->export_format,
|
||||||
'status' => $job->status,
|
'status' => $job->status,
|
||||||
'output_path' => $job->output_path,
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ final class TicketDrawMyMatchController extends Controller
|
|||||||
$itemIds = TicketItem::query()
|
$itemIds = TicketItem::query()
|
||||||
->where('draw_id', $draw->id)
|
->where('draw_id', $draw->id)
|
||||||
->where('player_id', $player->id)
|
->where('player_id', $player->id)
|
||||||
->whereIn('status', ['success', 'settled_win', 'settled_lose'])
|
->whereIn('status', ['pending_draw', 'settled_win', 'settled_lose'])
|
||||||
->pluck('id');
|
->pluck('id');
|
||||||
|
|
||||||
$hasBets = $itemIds->isNotEmpty();
|
$hasBets = $itemIds->isNotEmpty();
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ final class SettlementOrchestrator
|
|||||||
|
|
||||||
$ticketItems = TicketItem::query()
|
$ticketItems = TicketItem::query()
|
||||||
->where('draw_id', $locked->id)
|
->where('draw_id', $locked->id)
|
||||||
->where('status', 'success')
|
->where('status', 'pending_draw')
|
||||||
->with(['combinations', 'order'])
|
->with(['combinations', 'order'])
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->get();
|
->get();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ final class TicketPendingConfirmReconcileService
|
|||||||
->where('order_id', $lockedOrder->id)
|
->where('order_id', $lockedOrder->id)
|
||||||
->where('status', 'pending_confirm')
|
->where('status', 'pending_confirm')
|
||||||
->update([
|
->update([
|
||||||
'status' => 'success',
|
'status' => 'pending_draw',
|
||||||
'fail_reason_code' => null,
|
'fail_reason_code' => null,
|
||||||
'fail_reason_text' => null,
|
'fail_reason_text' => null,
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ final class TicketPlacementService
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
foreach ($successfulItems as $item) {
|
foreach ($successfulItems as $item) {
|
||||||
$item->forceFill(['status' => 'success'])->save();
|
$item->forceFill(['status' => 'pending_draw'])->save();
|
||||||
$this->jackpotContribution->recordFromPlacedTicketItem($item, $draw, (string) $placement['currency_code']);
|
$this->jackpotContribution->recordFromPlacedTicketItem($item, $draw, (string) $placement['currency_code']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ final class TicketPlacementService
|
|||||||
{
|
{
|
||||||
$order = TicketOrder::query()->whereKey($order->id)->firstOrFail();
|
$order = TicketOrder::query()->whereKey($order->id)->firstOrFail();
|
||||||
$draw = Draw::query()->whereKey((int) $order->draw_id)->firstOrFail();
|
$draw = Draw::query()->whereKey((int) $order->draw_id)->firstOrFail();
|
||||||
$successCount = TicketItem::query()->where('order_id', $order->id)->where('status', 'success')->count();
|
$successCount = TicketItem::query()->where('order_id', $order->id)->where('status', 'pending_draw')->count();
|
||||||
$failureCount = TicketItem::query()->where('order_id', $order->id)->where('status', 'failed')->count();
|
$failureCount = TicketItem::query()->where('order_id', $order->id)->where('status', 'failed')->count();
|
||||||
if ($balanceAfter === null) {
|
if ($balanceAfter === null) {
|
||||||
$walletTxn = WalletTxn::query()
|
$walletTxn = WalletTxn::query()
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ final class DashboardHallFixtureSeeder extends Seeder
|
|||||||
'combination_count' => 1,
|
'combination_count' => 1,
|
||||||
'estimated_max_payout' => 0,
|
'estimated_max_payout' => 0,
|
||||||
'risk_locked_amount' => 0,
|
'risk_locked_amount' => 0,
|
||||||
'status' => 'success',
|
'status' => 'pending_draw',
|
||||||
'fail_reason_code' => null,
|
'fail_reason_code' => null,
|
||||||
'fail_reason_text' => null,
|
'fail_reason_text' => null,
|
||||||
'win_amount' => 15_000,
|
'win_amount' => 15_000,
|
||||||
@@ -212,7 +212,7 @@ final class DashboardHallFixtureSeeder extends Seeder
|
|||||||
'combination_count' => 1,
|
'combination_count' => 1,
|
||||||
'estimated_max_payout' => 0,
|
'estimated_max_payout' => 0,
|
||||||
'risk_locked_amount' => 0,
|
'risk_locked_amount' => 0,
|
||||||
'status' => 'success',
|
'status' => 'pending_draw',
|
||||||
'fail_reason_code' => null,
|
'fail_reason_code' => null,
|
||||||
'fail_reason_text' => null,
|
'fail_reason_text' => null,
|
||||||
'win_amount' => 0,
|
'win_amount' => 0,
|
||||||
@@ -259,7 +259,7 @@ final class DashboardHallFixtureSeeder extends Seeder
|
|||||||
'combination_count' => 1,
|
'combination_count' => 1,
|
||||||
'estimated_max_payout' => 0,
|
'estimated_max_payout' => 0,
|
||||||
'risk_locked_amount' => 0,
|
'risk_locked_amount' => 0,
|
||||||
'status' => 'success',
|
'status' => 'pending_draw',
|
||||||
'fail_reason_code' => null,
|
'fail_reason_code' => null,
|
||||||
'fail_reason_text' => null,
|
'fail_reason_text' => null,
|
||||||
'win_amount' => 0,
|
'win_amount' => 0,
|
||||||
|
|||||||
@@ -440,14 +440,14 @@ test('ticket place can return mixed success and failed risk results', function (
|
|||||||
->assertJsonPath('code', ErrorCode::Success->value)
|
->assertJsonPath('code', ErrorCode::Success->value)
|
||||||
->assertJsonPath('data.summary.success_count', 1)
|
->assertJsonPath('data.summary.success_count', 1)
|
||||||
->assertJsonPath('data.summary.failure_count', 1)
|
->assertJsonPath('data.summary.failure_count', 1)
|
||||||
->assertJsonPath('data.items.0.status', 'success')
|
->assertJsonPath('data.items.0.status', 'pending_draw')
|
||||||
->assertJsonPath('data.items.1.status', 'failed')
|
->assertJsonPath('data.items.1.status', 'failed')
|
||||||
->assertJsonPath('data.items.1.fail_reason_code', (string) ErrorCode::RiskPoolSoldOut->value);
|
->assertJsonPath('data.items.1.fail_reason_code', (string) ErrorCode::RiskPoolSoldOut->value);
|
||||||
|
|
||||||
$order = TicketOrder::query()->firstOrFail();
|
$order = TicketOrder::query()->firstOrFail();
|
||||||
expect($order->status)->toBe('partial_failed')
|
expect($order->status)->toBe('partial_failed')
|
||||||
->and((int) $order->total_actual_deduct)->toBe(120)
|
->and((int) $order->total_actual_deduct)->toBe(120)
|
||||||
->and(TicketItem::query()->where('status', 'success')->count())->toBe(1)
|
->and(TicketItem::query()->where('status', 'pending_draw')->count())->toBe(1)
|
||||||
->and(TicketItem::query()->where('status', 'failed')->count())->toBe(1);
|
->and(TicketItem::query()->where('status', 'failed')->count())->toBe(1);
|
||||||
|
|
||||||
$wallet = PlayerWallet::query()->where('player_id', $player->id)->firstOrFail();
|
$wallet = PlayerWallet::query()->where('player_id', $player->id)->firstOrFail();
|
||||||
@@ -825,7 +825,7 @@ test('ticket pending confirmation reconcile confirms order when wallet deduction
|
|||||||
->assertExitCode(0);
|
->assertExitCode(0);
|
||||||
|
|
||||||
expect($order->fresh()->status)->toBe('placed')
|
expect($order->fresh()->status)->toBe('placed')
|
||||||
->and($item->fresh()->status)->toBe('success')
|
->and($item->fresh()->status)->toBe('pending_draw')
|
||||||
->and((int) RiskPool::query()->where('draw_id', $draw->id)->where('normalized_number', '1234')->value('locked_amount'))->toBe(3000);
|
->and((int) RiskPool::query()->where('draw_id', $draw->id)->where('normalized_number', '1234')->value('locked_amount'))->toBe(3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ test('my-match only highlights settled winning tickets', function (): void {
|
|||||||
'combination_count' => 1,
|
'combination_count' => 1,
|
||||||
'estimated_max_payout' => 20_000,
|
'estimated_max_payout' => 20_000,
|
||||||
'risk_locked_amount' => 20_000,
|
'risk_locked_amount' => 20_000,
|
||||||
'status' => 'success',
|
'status' => 'pending_draw',
|
||||||
'win_amount' => 0,
|
'win_amount' => 0,
|
||||||
'jackpot_win_amount' => 0,
|
'jackpot_win_amount' => 0,
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user