feat: 添加结算功能,更新 TicketItem 模型以支持最新结算详情,增强 DrawTickService 以自动处理结算,更新 TicketWalletService 以支持派彩入账,扩展 API 路由以管理结算批次和奖池
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Admin\Jackpot;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\JackpotPool;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* GET /api/v1/admin/jackpot/pools — Jackpot 奖池配置列表。
|
||||
*/
|
||||
final class AdminJackpotPoolIndexController extends Controller
|
||||
{
|
||||
public function __invoke(): JsonResponse
|
||||
{
|
||||
$rows = JackpotPool::query()->orderBy('currency_code')->get();
|
||||
|
||||
return ApiResponse::success([
|
||||
'items' => $rows->map(fn (JackpotPool $p) => $this->row($p))->values()->all(),
|
||||
]);
|
||||
}
|
||||
|
||||
/** @return array<string, mixed> */
|
||||
private function row(JackpotPool $p): array
|
||||
{
|
||||
return [
|
||||
'id' => (int) $p->id,
|
||||
'currency_code' => $p->currency_code,
|
||||
'current_amount' => (int) $p->current_amount,
|
||||
'contribution_rate' => (string) $p->contribution_rate,
|
||||
'trigger_threshold' => (int) $p->trigger_threshold,
|
||||
'payout_rate' => (string) $p->payout_rate,
|
||||
'force_trigger_draw_gap' => (int) $p->force_trigger_draw_gap,
|
||||
'min_bet_amount' => (int) $p->min_bet_amount,
|
||||
'status' => (int) $p->status,
|
||||
'last_trigger_draw_id' => $p->last_trigger_draw_id !== null ? (int) $p->last_trigger_draw_id : null,
|
||||
'updated_at' => $p->updated_at?->toIso8601String(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user