feat: 为玩家和管理员模块新增 API 路由与中间件别名

This commit is contained in:
2026-05-08 13:47:48 +08:00
parent 2d79e38de3
commit bbf58cb076
9 changed files with 174 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Support;
use Illuminate\Http\JsonResponse;
/**
* PRD / docs/04-领域字典与编码规范.md 对齐:{ code, msg, data }
*/
final class ApiResponse
{
public static function success(mixed $data = null, string $msg = 'ok', int $code = 0): JsonResponse
{
return response()->json([
'code' => $code,
'msg' => $msg,
'data' => $data,
]);
}
public static function error(string $msg, int $code, mixed $data = null, int $httpStatus = 400): JsonResponse
{
return response()->json([
'code' => $code,
'msg' => $msg,
'data' => $data,
], $httpStatus);
}
}