公开完整前后端的代码

This commit is contained in:
Linus Torvalds
2026-02-26 19:22:38 +08:00
commit 193de8a34f
161 changed files with 17373 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
# 错误的类型
API如果没有成功执行会返回一个错误类型`error_type`整型,它的涵义如下:
- 0:没有错误
- 1:服务器内部错误
- 2:无效请求
- 3:未授权访问
- 4:数据库错误
- 5:业务逻辑错误

View File

@@ -0,0 +1,29 @@
# 返回内容的格式
本项目的API通常返回JSON格式预览如下
```JSON
{
"success":true,
"msg":"API Execution OK"
}
```
```JSON
{
"success":false,
"msg":"API Execution met a problem",
"error_type":2,
"debug":"Can not bind your JSON Request body"
}
```
任何API都会返回`success``msg`字段,错误时还会返回`error_type`字段,如果打开`Debug.APIVerbose`会返回`debug`字段。
关于msg的内容可以看每个API在logic包中的开头注释具体信息位于`logic/errors.go`
另外在回应头里有字段`X-Request-Id`这是我们为每个HTTP请求生成的唯一ID可以用来在日志里查找相应的信息