Files
lotteryLaravel/app/Http/Controllers/Api/V1/HealthController.php

30 lines
729 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\Http\Controllers\Controller;
use App\Support\ApiResponse;
use Illuminate\Http\JsonResponse;
class HealthController extends Controller
{
/**
* 健康检查Next / 网关探活。路径GET /api/v1/health
*
* 非调试环境不返回框架版本号,避免信息泄露。
*/
public function __invoke(): JsonResponse
{
$payload = [
'app' => config('app.name'),
'default_currency' => config('lottery.default_currency'),
];
if (config('app.debug')) {
$payload['laravel'] = app()->version(); // 仅本地/调试
}
return ApiResponse::success($payload);
}
}