API 公共结果代码 (RstVal)
本文档介绍 GIIP 平台 API 公共响应字段
RstVal 和 RstMsg 的标准定义。
📋 概述
为了跟踪执行结果,所有 GIIP API 都会在响应数据的最顶层包含
RstVal(整型代码)和 RstMsg(描述性消息)。这些值遵循数据库中 tDefRst(结果定义)表的标准。
用户提到的 tRstVal 指的是 tDefRst 表中的 drRstVal 列。开发者在进行 API 对接和开发时,可以参考以下定义的代码来实现异常处理。
📡 主要结果代码 (Major Codes)
| RstVal | RstMsg | 含义 | 备注 |
|---|---|---|---|
| 200 | Process has done successfully | 成功 | 标准成功响应 |
| 400 | No data found | 请求错误 | 缺少参数或数据为空 |
| 401 | Unauthorized | 认证失败 | 凭据错误或会话已过期 |
| 403 | Forbidden | 无权限 | 访问权限不足 |
| 404 | No data found | 未找到 | 资源不存在 |
| 500 | System error | 系统错误 | 服务器内部逻辑或数据库错误 |
🔍 详细结果代码列表 (tDefRst)
系统内部使用的详细结果代码列表,包含针对积分、注册、外部对接等特定领域的详细消息。
| drRstVal | drRstMsg | 类别 |
|---|---|---|
| 100 | Starting Stored Procedure... | 系统 |
| 102 | Data is not match | 校验 |
| 201 | Created successfully | 创建 |
| 204 | No content available | 数据 |
| 211 | It is clean email. go next... | 注册 |
| 212 | Already registered user. | 注册 |
| 220 | Charge process has done successfully | 支付/积分 |
| 221 | Point process has done successfully | 积分 |
| 230 | Buying process has done successfully | 购买 |
| 250 | Prayed successfully | 其他 |
| 300 | Permission error | 权限 |
| 301 | Not enough point | 积分 |
| 302 | Already data exists. | 重复 |
| 312 | Pre-registered but not have User data. | 注册状态 |
| 313 | Input status is lower than dbStatus. | 一致性 |
| 320 | It cannot be processed point processing | 积分 |
| 330 | You have NFT Token already. | 资产 |
| 332 | Already sold out. | 购买 |
| 333 | Event item limit reached. | 活动 |
| 390 | Already registered this wallet. | 认证/钱包 |
| 405 | Method not allowed | 服务器/HTTP |
| 409 | Conflict: Resource already exists | 状态冲突 |
| 410 | Gone: Resource no longer available | 已失效/已删除 |
| 420 | You don't have enough point | 积分 |
| 421 | Not same point and point history. | 数据一致性 |
| 502 | Bad Gateway: Upstream error | 网络 |
💡 开发者建议
- 判定成功: 建议仅在
为RstVal
时继续执行业务逻辑。200 - 错误处理:
系列代码通常表示客户端需要修正请求,而400
系列代码则需要系统管理员介入检查。500 - 消息使用:
主要用于开发者调试。对于最终用户,建议根据其语言环境实现对应的提示逻辑。RstMsg
故障排除
| 症状 | 原因 | 解决 |
|---|---|---|
API 响应返回 为 | 凭据错误或会话已过期 | 重新确认认证密钥并刷新会话后重新发送请求。 |
为 或 且数据为空 | 缺少必填参数或请求的资源不存在 | 检查请求参数,并使用有效且存在的资源标识符重新请求。 |
为 / 导致处理中断 | 未满足积分不足等业务条件 | 查看 (如 Not enough point),满足前置条件后重试。 |
返回 / | 服务器内部逻辑/数据库错误或上游网关错误 | 请勿在客户端重试,携带 联系系统管理员。 |
相关文档: