feat(draw): 支持多玩法provider及本地化结算时区功能
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
lotterLaravel E2E / e2e-api (push) Has been cancelled

- 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:
2026-07-09 15:48:21 +08:00
parent c6c10f1397
commit d4779660c8
38 changed files with 1121 additions and 271 deletions

View File

@@ -28,6 +28,7 @@ final class AdminDrawResultBatchesIndexController extends Controller
->with(['items' => function ($q): void {
$q->orderBy('prize_type')->orderBy('prize_index');
}])
->orderBy('provider_code')
->orderByDesc('result_version');
if (! $manage) {

View File

@@ -31,7 +31,12 @@ final class DrawManualResultBatchStoreController extends Controller
}
try {
$batch = $this->service->createPendingBatch($draw, $admin, $request->validated('items'));
$batch = $this->service->createPendingBatch(
$draw,
$admin,
$request->validated('items'),
$request->validated('provider_code'),
);
} catch (\RuntimeException $e) {
return ApiMessage::runtimeErrorResponse($request, $e);
}
@@ -43,6 +48,8 @@ final class DrawManualResultBatchStoreController extends Controller
'status' => $draw->status,
'batch' => [
'id' => (int) $batch->id,
'provider_code' => $batch->provider_code,
'provider_name' => $batch->provider_name,
'result_version' => (int) $batch->result_version,
'source_type' => $batch->source_type,
'status' => $batch->status,

View File

@@ -54,7 +54,9 @@ final class DrawResultBatchPublishController extends Controller
return ApiResponse::success([
'draw_no' => $draw->draw_no,
'status' => $draw->status,
'result_version' => (int) $draw->current_result_version,
'provider_code' => $batch->provider_code,
'provider_name' => $batch->provider_name,
'result_version' => (int) $batch->result_version,
]);
}
}

View File

@@ -11,6 +11,7 @@ use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use App\Services\Draw\DrawRngRunner;
use App\Models\DrawResultBatch;
final class DrawRngRunController extends Controller
{
@@ -38,17 +39,34 @@ final class DrawRngRunController extends Controller
}
$draw->refresh();
$batches = DrawResultBatch::query()
->where('draw_id', $draw->id)
->where('result_version', (int) $batch->result_version)
->where('source_type', $batch->source_type)
->orderBy('provider_code')
->get();
return ApiResponse::success([
'draw_no' => $draw->draw_no,
'status' => $draw->status,
'batch' => [
'id' => (int) $batch->id,
'provider_code' => $batch->provider_code,
'provider_name' => $batch->provider_name,
'result_version' => (int) $batch->result_version,
'source_type' => $batch->source_type,
'status' => $batch->status,
'items_count' => $batch->items()->count(),
],
'batches' => $batches->map(fn (DrawResultBatch $row): array => [
'id' => (int) $row->id,
'provider_code' => $row->provider_code,
'provider_name' => $row->provider_name,
'result_version' => (int) $row->result_version,
'source_type' => $row->source_type,
'status' => $row->status,
'items_count' => $row->items()->count(),
])->values()->all(),
]);
}
}