feat: 拆分开奖与结算审核流程,新增手动结果录入、重开和派彩审批接口
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use App\Models\Draw;
|
||||
use App\Models\Player;
|
||||
use App\Models\AdminUser;
|
||||
use App\Models\TicketItem;
|
||||
use App\Lottery\DrawStatus;
|
||||
use App\Models\JackpotPool;
|
||||
@@ -10,7 +11,9 @@ use App\Models\PlayerWallet;
|
||||
use App\Models\DrawResultItem;
|
||||
use App\Models\DrawResultBatch;
|
||||
use App\Models\JackpotPayoutLog;
|
||||
use App\Models\SettlementBatch;
|
||||
use App\Models\JackpotContribution;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Database\Seeders\CurrencySeeder;
|
||||
use Database\Seeders\PlayTypeSeeder;
|
||||
use App\Lottery\DrawResultBatchStatus;
|
||||
@@ -19,6 +22,7 @@ use Database\Seeders\LotterySettingsSeeder;
|
||||
use Database\Seeders\OperationalConfigV1Seeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use App\Services\Settlement\SettlementOrchestrator;
|
||||
use App\Services\Settlement\SettlementBatchWorkflowService;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
@@ -128,6 +132,18 @@ test('jackpot contributes on place and bursts on settle for first-prize straight
|
||||
$ran = app(SettlementOrchestrator::class)->trySettleDraw($draw->fresh());
|
||||
expect($ran)->toBeTrue();
|
||||
|
||||
$admin = AdminUser::query()->create([
|
||||
'username' => 'jp_settle_admin',
|
||||
'name' => 'JP Settle Admin',
|
||||
'email' => null,
|
||||
'password' => Hash::make('secret-strong'),
|
||||
'status' => 0,
|
||||
]);
|
||||
grantSuperAdminRole($admin);
|
||||
$settlementBatch = SettlementBatch::query()->where('draw_id', $draw->id)->firstOrFail();
|
||||
app(SettlementBatchWorkflowService::class)->approve($settlementBatch, $admin);
|
||||
app(SettlementBatchWorkflowService::class)->payout($settlementBatch->fresh());
|
||||
|
||||
$item = TicketItem::query()->where('draw_id', $draw->id)->firstOrFail();
|
||||
expect((int) $item->win_amount)->toBe(250_000);
|
||||
expect((int) $item->jackpot_win_amount)->toBe(1_000);
|
||||
|
||||
Reference in New Issue
Block a user