feat: 添加结算功能,更新 TicketItem 模型以支持最新结算详情,增强 DrawTickService 以自动处理结算,更新 TicketWalletService 以支持派彩入账,扩展 API 路由以管理结算批次和奖池
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Jackpot;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\JackpotPool;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* `GET /api/v1/jackpot/summary` — 当前奖池水位(公开;玩家端开奖区展示)。
|
||||
*/
|
||||
class JackpotSummaryController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request): JsonResponse
|
||||
{
|
||||
$currency = strtoupper(trim((string) $request->query('currency_code', 'NPR')));
|
||||
if (strlen($currency) > 16) {
|
||||
$currency = 'NPR';
|
||||
}
|
||||
|
||||
$pool = JackpotPool::query()
|
||||
->where('currency_code', $currency)
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
return ApiResponse::success([
|
||||
'currency_code' => $currency,
|
||||
'enabled' => $pool !== null,
|
||||
'current_amount_minor' => $pool !== null ? (int) $pool->current_amount : 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user