Files
lotteryLaravel/app/Http/Controllers/Api/V1/HealthController.php
kang 8ccf39dff5 refactor: 迁移彩票设置至 LotterySettings 服务
- 更新多个控制器和服务,使用 LotterySettings 服务获取彩票相关配置,如默认币种、开奖间隔、下注窗口等,提升代码一致性与可维护性。
- 移除 .env.example 中不再使用的配置项,建议通过后台管理进行设置。
2026-05-28 14:50:25 +08:00

31 lines
769 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Http\Controllers\Api\V1;
use App\Support\ApiResponse;
use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;
use App\Services\LotterySettings;
final class HealthController extends Controller
{
/**
* 健康检查Next / 网关探活。路径GET /api/v1/health
*
* 非调试环境不返回框架版本号,避免信息泄露。
*/
public function __invoke(): JsonResponse
{
$payload = [
'app' => config('app.name'),
'default_currency' => LotterySettings::defaultCurrency(),
];
if (config('app.debug')) {
$payload['laravel'] = app()->version(); // 仅本地/调试
}
return ApiResponse::success($payload);
}
}