统一规范状态码

This commit is contained in:
2026-03-04 16:07:07 +08:00
parent 5d0e2a82ff
commit a6858adf14
5 changed files with 50 additions and 24 deletions

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace app\api\util;
/**
* API 状态码统一管理
*/
class ReturnCode
{
/** 200 成功 */
public const SUCCESS = 200;
/** 201 请携带 tokenauth-token / user-token */
public const MISSING_TOKEN = 201;
/** 202 缺少参数 / 参数错误 / 业务校验不通过(如余额不足、购买抽奖券错误等) */
public const EMPTY_PARAMS = 202;
/** 203 token 过期或无效auth-token / user-token 过期、缓存已过期等) */
public const TOKEN_TIMEOUT = 203;
}