- 更新多个控制器和服务,使用 LotterySettings 服务获取彩票相关配置,如默认币种、开奖间隔、下注窗口等,提升代码一致性与可维护性。 - 移除 .env.example 中不再使用的配置项,建议通过后台管理进行设置。
31 lines
840 B
PHP
31 lines
840 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Jackpot;
|
|
|
|
use App\Support\ApiResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\JsonResponse;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\LotterySettings;
|
|
use App\Services\Jackpot\JackpotSummaryService;
|
|
|
|
/**
|
|
* `GET /api/v1/jackpot/summary` — 当前奖池水位(公开;玩家端开奖区展示)。
|
|
*/
|
|
final class JackpotSummaryController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly JackpotSummaryService $summary,
|
|
) {}
|
|
|
|
public function __invoke(Request $request): JsonResponse
|
|
{
|
|
$currencyCode = strtoupper(trim((string) $request->query(
|
|
'currency_code',
|
|
LotterySettings::defaultCurrency(),
|
|
)));
|
|
|
|
return ApiResponse::success($this->summary->summary($currencyCode));
|
|
}
|
|
}
|