docs(api): 更新API文档和接口测试指南
- 为管理员登录接口添加完整的Swagger文档注释 - 修复支付和订单相关接口的参数类型定义 - 更新订单查询接口使用订单号作为路径参数 - 添加支付记录导出功能的API文档 - 创建详细的Apifox接口测试指南文档 - 修正金额参数的数据格式为float64 - 更新接口描述以反映分表后的查询逻辑
This commit is contained in:
@@ -54,6 +54,22 @@ func (r *AuthController) getLoginRequestData(ctx http.Context) string {
|
||||
}
|
||||
|
||||
// Login 管理员登录
|
||||
// @Summary 管理员登录
|
||||
// @Description 管理员登录接口,支持用户名密码登录。如果管理员绑定了谷歌验证码,需要提供 google_code;如果未绑定但启用了图形验证码,需要提供 captcha_id 和 captcha_answer。登录成功后返回 JWT Token,Token 会同时出现在响应体的 data.token 和响应头 Authorization 中。
|
||||
// @Tags 认证管理
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param username body string true "用户名"
|
||||
// @Param password body string true "密码(最少6位)"
|
||||
// @Param captcha_id body string false "图形验证码ID(如果启用了图形验证码且未绑定谷歌验证码)"
|
||||
// @Param captcha_answer body string false "图形验证码答案(如果启用了图形验证码且未绑定谷歌验证码)"
|
||||
// @Param google_code body string false "谷歌验证码(如果绑定了谷歌验证码)"
|
||||
// @Success 200 {object} map[string]any "登录成功,返回 Token 和管理员信息"
|
||||
// @Failure 400 {object} map[string]any "参数错误、验证码错误或谷歌验证码错误"
|
||||
// @Failure 401 {object} map[string]any "用户名或密码错误"
|
||||
// @Failure 403 {object} map[string]any "账号已禁用"
|
||||
// @Failure 500 {object} map[string]any "服务器错误"
|
||||
// @Router /api/admin/login [post]
|
||||
func (r *AuthController) Login(ctx http.Context) http.Response {
|
||||
var loginRequest admin.Login
|
||||
errors, err := ctx.Request().ValidateRequest(&loginRequest)
|
||||
|
||||
@@ -0,0 +1,555 @@
|
||||
# Apifox 接口测试指南
|
||||
|
||||
本指南将帮助您使用 Apifox 测试项目的 API 接口。
|
||||
|
||||
## 目录
|
||||
|
||||
1. [准备工作](#准备工作)
|
||||
2. [导入 Swagger 文档](#导入-swagger-文档)
|
||||
3. [配置环境变量](#配置环境变量)
|
||||
4. [配置认证](#配置认证)
|
||||
5. [测试接口](#测试接口)
|
||||
6. [常见问题](#常见问题)
|
||||
|
||||
---
|
||||
|
||||
## 准备工作
|
||||
|
||||
### 1. 启动后端服务
|
||||
|
||||
确保后端服务已启动并运行:
|
||||
|
||||
```bash
|
||||
cd server
|
||||
go run . --no-ansi
|
||||
```
|
||||
|
||||
默认服务地址:`http://localhost:3000`
|
||||
|
||||
### 2. 访问 Swagger 文档
|
||||
|
||||
在浏览器中访问 Swagger 文档页面,确认接口文档正常:
|
||||
|
||||
- 本地开发:`http://localhost:3000/swagger/index.html`
|
||||
- Swagger JSON:`http://localhost:3000/swagger/doc.json`
|
||||
- Swagger YAML:`http://localhost:3000/swagger/doc.yaml`
|
||||
|
||||
### 3. 默认登录信息
|
||||
|
||||
- **用户名**:`admin`
|
||||
- **密码**:`admin123`
|
||||
|
||||
> ⚠️ **注意**:首次登录后请修改默认密码
|
||||
|
||||
---
|
||||
|
||||
## 导入 Swagger 文档
|
||||
|
||||
### 方法一:通过 URL 导入(推荐)
|
||||
|
||||
1. 打开 Apifox
|
||||
2. 点击 **项目设置** → **导入** → **URL 导入**
|
||||
3. 输入 Swagger 文档地址:
|
||||
```
|
||||
http://localhost:3000/swagger/doc.json
|
||||
```
|
||||
或
|
||||
```
|
||||
http://localhost:3000/swagger/doc.yaml
|
||||
```
|
||||
4. 点击 **导入**,等待导入完成
|
||||
|
||||
### 方法二:通过文件导入
|
||||
|
||||
1. 打开 Apifox
|
||||
2. 点击 **项目设置** → **导入** → **文件导入**
|
||||
3. 选择项目中的 Swagger 文件:
|
||||
- `server/docs/swagger.json`
|
||||
- 或 `server/docs/swagger.yaml`
|
||||
4. 点击 **导入**,等待导入完成
|
||||
|
||||
### 方法三:手动导入(如果上述方法失败)
|
||||
|
||||
1. 访问 `http://localhost:3000/swagger/doc.json`
|
||||
2. 复制 JSON 内容
|
||||
3. 在 Apifox 中选择 **导入** → **OpenAPI/Swagger** → **粘贴内容**
|
||||
4. 粘贴 JSON 内容并导入
|
||||
|
||||
---
|
||||
|
||||
## 配置环境变量
|
||||
|
||||
### 1. 创建环境
|
||||
|
||||
1. 在 Apifox 中点击 **环境管理**
|
||||
2. 创建新环境,命名为 **本地开发** 或 **Local**
|
||||
3. 添加以下环境变量:
|
||||
|
||||
| 变量名 | 初始值 | 说明 |
|
||||
|--------|--------|------|
|
||||
| `base_url` | `http://localhost:3000` | API 基础地址 |
|
||||
| `api_prefix` | `/api/admin` | API 前缀 |
|
||||
| `token` | (留空,将通过登录获取) | JWT Token |
|
||||
|
||||
### 2. 设置环境变量
|
||||
|
||||
在接口 URL 中使用环境变量:
|
||||
|
||||
```
|
||||
{{base_url}}{{api_prefix}}/login
|
||||
```
|
||||
|
||||
这样可以在不同环境(开发、测试、生产)之间快速切换。
|
||||
|
||||
---
|
||||
|
||||
## 配置认证
|
||||
|
||||
### JWT Token 说明
|
||||
|
||||
本项目使用 **JWT Token** 进行身份认证,Token 格式为:
|
||||
|
||||
```
|
||||
Authorization: Bearer {token}
|
||||
```
|
||||
|
||||
**重要说明**:
|
||||
- Token 通过 **请求头** `Authorization` 传递
|
||||
- 格式必须是:`Bearer {token}`(注意 Bearer 后面有一个空格)
|
||||
- Token 默认有效期为 **60 分钟**(可在配置文件中修改)
|
||||
- 系统支持**滑动过期**:每次请求时自动延长 Token 过期时间
|
||||
- Token 存储在数据库中,可以主动撤销
|
||||
|
||||
### 方法一:使用全局认证(推荐)
|
||||
|
||||
1. 在 Apifox 中点击 **项目设置** → **认证配置**
|
||||
2. 选择 **Bearer Token** 认证方式
|
||||
3. 在 **Token** 字段中输入:`{{token}}`
|
||||
4. 保存配置
|
||||
|
||||
这样所有需要认证的接口都会自动添加 `Authorization: Bearer {{token}}` 请求头。
|
||||
|
||||
### 方法二:使用前置脚本自动获取 Token
|
||||
|
||||
1. 在 **项目设置** → **前置脚本** 中添加以下代码:
|
||||
|
||||
```javascript
|
||||
// 自动登录并获取 token
|
||||
const loginResponse = await apifox.request({
|
||||
method: 'POST',
|
||||
url: '{{base_url}}{{api_prefix}}/login',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: {
|
||||
mode: 'json',
|
||||
json: {
|
||||
username: 'admin',
|
||||
password: 'admin123'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 解析响应并保存 token
|
||||
if (loginResponse.code === 200 && loginResponse.data.token) {
|
||||
apifox.setEnvironmentVariable('token', loginResponse.data.token);
|
||||
console.log('登录成功,Token 已自动保存');
|
||||
} else {
|
||||
console.error('登录失败:', loginResponse);
|
||||
}
|
||||
```
|
||||
|
||||
2. 在需要认证的接口中,使用 `{{token}}` 作为 Bearer Token
|
||||
|
||||
### 方法三:手动设置 Token
|
||||
|
||||
1. 先调用登录接口获取 Token:
|
||||
- **接口**:`POST /api/admin/login`
|
||||
- **请求体**:
|
||||
```json
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "admin123"
|
||||
}
|
||||
```
|
||||
- **响应示例**:
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"message": "登录成功",
|
||||
"data": {
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"admin": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"nickname": "管理员"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. 复制响应中的 `token` 值
|
||||
|
||||
3. 在环境变量中设置 `token` 的值,或在接口的 **认证** 标签页中手动输入
|
||||
|
||||
---
|
||||
|
||||
## 测试接口
|
||||
|
||||
### 1. 测试登录接口
|
||||
|
||||
1. 找到 **认证管理** → **管理员登录** 接口(`POST /api/admin/login`)
|
||||
2. 设置请求参数:
|
||||
```json
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "admin123"
|
||||
}
|
||||
```
|
||||
> **注意**:
|
||||
> - 如果管理员绑定了谷歌验证码,需要添加 `google_code` 字段
|
||||
> - 如果未绑定谷歌验证码但启用了图形验证码,需要先调用获取验证码接口,然后添加 `captcha_id` 和 `captcha_answer` 字段
|
||||
|
||||
3. 点击 **发送**
|
||||
4. 检查响应:
|
||||
- **响应体**:包含 `token` 和管理员信息
|
||||
```json
|
||||
{
|
||||
"code": 200,
|
||||
"message": "登录成功",
|
||||
"data": {
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
|
||||
"admin": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"nickname": "管理员",
|
||||
"avatar": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
- **响应头**:包含 `Authorization: Bearer {token}`(Apifox 会自动识别并保存)
|
||||
|
||||
5. **保存 Token**:
|
||||
- Apifox 会自动从响应头或响应体中提取 Token 并保存到环境变量 `{{token}}`
|
||||
- 如果没有自动保存,可以手动复制响应中的 `token` 值,然后在环境变量中设置
|
||||
|
||||
### 2. 测试需要认证的接口
|
||||
|
||||
#### 示例:获取管理员列表
|
||||
|
||||
1. 找到 **管理员管理** → **获取管理员列表** 接口
|
||||
2. 确认已配置认证(Bearer Token)
|
||||
3. 设置查询参数(可选):
|
||||
- `page`: 1
|
||||
- `page_size`: 10
|
||||
- `username`: (可选,模糊搜索)
|
||||
- `status`: (可选,1-启用,0-禁用)
|
||||
4. 点击 **发送**
|
||||
5. 检查响应数据
|
||||
|
||||
#### 示例:创建管理员
|
||||
|
||||
1. 找到 **管理员管理** → **创建管理员** 接口
|
||||
2. 设置请求体:
|
||||
```json
|
||||
{
|
||||
"username": "testuser",
|
||||
"password": "test123456",
|
||||
"nickname": "测试用户",
|
||||
"email": "test@example.com",
|
||||
"phone": "13800138000",
|
||||
"department_id": 1,
|
||||
"status": 1,
|
||||
"role_ids": [1]
|
||||
}
|
||||
```
|
||||
3. 点击 **发送**
|
||||
4. 检查响应
|
||||
|
||||
### 3. 测试其他模块
|
||||
|
||||
按照相同的方式测试其他模块的接口:
|
||||
|
||||
- **订单管理**:`/api/admin/orders`
|
||||
- **用户管理**:`/api/admin/users`
|
||||
- **支付管理**:`/api/admin/payments`
|
||||
- **角色管理**:`/api/admin/roles`
|
||||
- **权限管理**:`/api/admin/permissions`
|
||||
- 等等...
|
||||
|
||||
---
|
||||
|
||||
## 常见问题
|
||||
|
||||
### Q1: 代码更新后,Swagger 文档会自动更新吗?
|
||||
|
||||
**答案:不会自动更新!**
|
||||
|
||||
Swagger 文档是基于代码中的注解(`@Summary`, `@Description`, `@Tags` 等)**静态生成**的,代码更新后需要手动重新生成文档。
|
||||
|
||||
**更新步骤**:
|
||||
|
||||
1. **修改代码后,重新生成 Swagger 文档**:
|
||||
```bash
|
||||
cd server
|
||||
swag init
|
||||
```
|
||||
这会重新生成以下文件:
|
||||
- `docs/docs.go`
|
||||
- `docs/swagger.json`
|
||||
- `docs/swagger.yaml`
|
||||
|
||||
2. **重启后端服务**(如果服务正在运行):
|
||||
```bash
|
||||
# 停止当前服务(Ctrl+C)
|
||||
# 重新启动
|
||||
go run . --no-ansi
|
||||
```
|
||||
|
||||
3. **在 Apifox 中重新导入文档**:
|
||||
- 方法一:通过 URL 重新导入 `http://localhost:3000/swagger/doc.json`
|
||||
- 方法二:通过文件重新导入 `server/docs/swagger.json`
|
||||
|
||||
**什么时候需要更新文档**:
|
||||
- ✅ 添加了新的接口
|
||||
- ✅ 修改了接口路径
|
||||
- ✅ 修改了请求参数(添加、删除、修改参数)
|
||||
- ✅ 修改了响应结构
|
||||
- ✅ 修改了接口描述或标签
|
||||
- ✅ 添加或修改了 Swagger 注解
|
||||
|
||||
**开发建议**:
|
||||
- 每次修改接口后,记得运行 `swag init` 更新文档
|
||||
- 可以将 `swag init` 添加到 Git 提交前的检查清单中
|
||||
- 团队协作时,确保文档与代码同步更新
|
||||
|
||||
### Q2: 导入 Swagger 文档后,接口显示不完整?
|
||||
|
||||
**解决方案**:
|
||||
1. 确认后端服务已启动
|
||||
2. 确认 Swagger 文档可以正常访问:`http://localhost:3000/swagger/index.html`
|
||||
3. 尝试重新生成 Swagger 文档:
|
||||
```bash
|
||||
cd server
|
||||
swag init
|
||||
```
|
||||
4. 重新导入 Swagger 文档
|
||||
|
||||
### Q3: 接口返回 401 未授权错误?
|
||||
|
||||
**解决方案**:
|
||||
1. **确认请求头格式正确**:
|
||||
- 请求头名称:`Authorization`
|
||||
- 请求头值:`Bearer {token}`(注意 Bearer 后面有一个空格)
|
||||
- 示例:`Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...`
|
||||
|
||||
2. **确认 Token 未过期**:
|
||||
- Token 默认有效期为 60 分钟
|
||||
- 如果 Token 过期,需要重新登录获取新的 Token
|
||||
|
||||
3. **检查 Token 是否正确**:
|
||||
- 确认 Token 是从登录接口获取的最新 Token
|
||||
- 确认 Token 没有被手动修改或截断
|
||||
|
||||
4. **重新登录获取 Token**:
|
||||
- 调用登录接口:`POST /api/admin/login`
|
||||
- 从响应中获取新的 Token
|
||||
- 更新环境变量中的 `{{token}}` 值
|
||||
|
||||
5. **检查 Apifox 认证配置**:
|
||||
- 确认已启用全局认证
|
||||
- 确认认证方式为 Bearer Token
|
||||
- 确认 Token 值设置为 `{{token}}`
|
||||
|
||||
### Q4: 接口返回 403 无权限错误?
|
||||
|
||||
**解决方案**:
|
||||
1. 确认当前登录的管理员账号有相应的权限
|
||||
2. 检查角色权限配置
|
||||
3. 确认接口路径和权限标识匹配
|
||||
|
||||
### Q5: 接口返回 400 参数错误?
|
||||
|
||||
**解决方案**:
|
||||
1. 检查请求参数格式是否正确
|
||||
2. 查看 Swagger 文档中的参数说明
|
||||
3. 确认必填参数都已提供
|
||||
4. 检查参数类型是否正确(字符串、数字、布尔值等)
|
||||
|
||||
### Q6: 如何测试文件上传接口?
|
||||
|
||||
**示例:上传附件**
|
||||
|
||||
1. 找到 **附件管理** → **上传附件** 接口
|
||||
2. 在 **Body** 标签页选择 **form-data**
|
||||
3. 添加字段:
|
||||
- `file`: 选择文件类型,上传文件
|
||||
- `display_name`: (可选)显示名称
|
||||
4. 点击 **发送**
|
||||
|
||||
### Q7: 如何测试需要验证码的接口?
|
||||
|
||||
**登录接口可能需要验证码**:
|
||||
|
||||
#### 情况一:图形验证码(如果启用了且未绑定谷歌验证码)
|
||||
|
||||
1. 先调用获取验证码接口:`GET /api/admin/login/captcha`
|
||||
2. 获取响应中的 `captcha_id` 和验证码图片(base64 格式)
|
||||
3. 在登录请求中添加:
|
||||
```json
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "admin123",
|
||||
"captcha_id": "xxx",
|
||||
"captcha_answer": "1234"
|
||||
}
|
||||
```
|
||||
|
||||
#### 情况二:谷歌验证码(如果管理员绑定了谷歌验证码)
|
||||
|
||||
1. 在登录请求中添加 `google_code` 字段:
|
||||
```json
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "admin123",
|
||||
"google_code": "123456"
|
||||
}
|
||||
```
|
||||
2. `google_code` 是从 Google Authenticator 应用中获取的 6 位数字验证码
|
||||
|
||||
#### 情况三:无需验证码
|
||||
|
||||
如果管理员未绑定谷歌验证码且系统未启用图形验证码,则只需要用户名和密码即可登录。
|
||||
|
||||
### Q8: 如何批量测试多个接口?
|
||||
|
||||
**使用 Apifox 的测试套件功能**:
|
||||
|
||||
1. 创建测试套件
|
||||
2. 添加需要测试的接口
|
||||
3. 设置测试顺序(先登录,再测试其他接口)
|
||||
4. 运行测试套件
|
||||
|
||||
### Q9: 如何查看接口响应时间?
|
||||
|
||||
在 Apifox 的响应面板中,可以看到:
|
||||
- **响应时间**:接口请求耗时
|
||||
- **状态码**:HTTP 状态码
|
||||
- **响应大小**:响应数据大小
|
||||
|
||||
---
|
||||
|
||||
## 接口测试清单
|
||||
|
||||
### 认证相关
|
||||
- [ ] 登录接口(获取 Token)
|
||||
- [ ] 获取当前管理员信息
|
||||
- [ ] 登出接口
|
||||
- [ ] 心跳检测接口
|
||||
|
||||
### 管理员管理
|
||||
- [ ] 获取管理员列表(分页、筛选)
|
||||
- [ ] 获取管理员详情
|
||||
- [ ] 创建管理员
|
||||
- [ ] 更新管理员信息
|
||||
- [ ] 删除管理员
|
||||
- [ ] 导出管理员列表
|
||||
|
||||
### 角色和权限
|
||||
- [ ] 获取角色列表
|
||||
- [ ] 创建角色
|
||||
- [ ] 更新角色
|
||||
- [ ] 获取权限列表
|
||||
- [ ] 角色权限绑定
|
||||
|
||||
### 其他模块
|
||||
- [ ] 订单管理接口
|
||||
- [ ] 用户管理接口
|
||||
- [ ] 支付管理接口
|
||||
- [ ] 菜单管理接口
|
||||
- [ ] 部门管理接口
|
||||
- [ ] 字典管理接口
|
||||
- [ ] 配置管理接口
|
||||
- [ ] 日志查询接口
|
||||
|
||||
---
|
||||
|
||||
## 高级功能
|
||||
|
||||
### 1. 使用环境变量
|
||||
|
||||
在不同环境间切换:
|
||||
|
||||
```javascript
|
||||
// 开发环境
|
||||
base_url = http://localhost:3000
|
||||
|
||||
// 测试环境
|
||||
base_url = http://test.example.com
|
||||
|
||||
// 生产环境
|
||||
base_url = https://api.example.com
|
||||
```
|
||||
|
||||
### 2. 使用前置/后置脚本
|
||||
|
||||
**前置脚本示例**(自动登录):
|
||||
```javascript
|
||||
// 检查 token 是否存在且未过期
|
||||
const token = apifox.getEnvironmentVariable('token');
|
||||
if (!token) {
|
||||
// 自动登录获取 token
|
||||
// ... 登录逻辑
|
||||
}
|
||||
```
|
||||
|
||||
**后置脚本示例**(提取响应数据):
|
||||
```javascript
|
||||
// 从响应中提取 token 并保存
|
||||
const response = pm.response.json();
|
||||
if (response.code === 200 && response.data.token) {
|
||||
apifox.setEnvironmentVariable('token', response.data.token);
|
||||
}
|
||||
```
|
||||
|
||||
### 3. 使用 Mock 数据
|
||||
|
||||
在 Apifox 中可以:
|
||||
1. 创建 Mock 服务器
|
||||
2. 设置 Mock 规则
|
||||
3. 生成随机测试数据
|
||||
|
||||
### 4. 接口文档导出
|
||||
|
||||
1. 在 Apifox 中选择接口
|
||||
2. 点击 **导出**
|
||||
3. 选择导出格式(Markdown、HTML、PDF 等)
|
||||
|
||||
---
|
||||
|
||||
## 相关资源
|
||||
|
||||
- **Swagger 文档**:`http://localhost:3000/swagger/index.html`
|
||||
- **项目文档**:`server/docs/API.md`
|
||||
- **开发指南**:`server/docs/DEVELOPMENT_GUIDE.md`
|
||||
- **Goravel 文档**:https://www.goravel.dev
|
||||
|
||||
---
|
||||
|
||||
## 总结
|
||||
|
||||
使用 Apifox 测试接口的步骤:
|
||||
|
||||
1. ✅ 导入 Swagger 文档
|
||||
2. ✅ 配置环境变量
|
||||
3. ✅ 配置认证(Bearer Token)
|
||||
4. ✅ 先测试登录接口获取 Token
|
||||
5. ✅ 测试其他需要认证的接口
|
||||
|
||||
如果遇到问题,请参考 [常见问题](#常见问题) 部分或查看项目文档。
|
||||
|
||||
---
|
||||
|
||||
*最后更新:2026-01-16*
|
||||
|
||||
+271
-33
@@ -698,6 +698,102 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/login": {
|
||||
"post": {
|
||||
"description": "管理员登录接口,支持用户名密码登录。如果管理员绑定了谷歌验证码,需要提供 google_code;如果未绑定但启用了图形验证码,需要提供 captcha_id 和 captcha_answer。登录成功后返回 JWT Token,Token 会同时出现在响应体的 data.token 和响应头 Authorization 中。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"认证管理"
|
||||
],
|
||||
"summary": "管理员登录",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "用户名",
|
||||
"name": "username",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "密码(最少6位)",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "图形验证码ID(如果启用了图形验证码且未绑定谷歌验证码)",
|
||||
"name": "captcha_id",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "图形验证码答案(如果启用了图形验证码且未绑定谷歌验证码)",
|
||||
"name": "captcha_answer",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "谷歌验证码(如果绑定了谷歌验证码)",
|
||||
"name": "google_code",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "登录成功,返回 Token 和管理员信息",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误、验证码错误或谷歌验证码错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "用户名或密码错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "账号已禁用",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "服务器错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/orders": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -751,12 +847,14 @@ const docTemplate = `{
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最小金额",
|
||||
"name": "min_amount",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最大金额",
|
||||
"name": "max_amount",
|
||||
"in": "query"
|
||||
@@ -925,12 +1023,14 @@ const docTemplate = `{
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最小金额",
|
||||
"name": "min_amount",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最大金额",
|
||||
"name": "max_amount",
|
||||
"in": "query"
|
||||
@@ -1132,7 +1232,7 @@ const docTemplate = `{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据ID或订单号获取订单详细信息,返回订单主表数据和订单详情表数据(支持分表查询)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询",
|
||||
"description": "根据订单号获取订单详细信息,返回订单主表数据和订单详情表数据(支持分表查询)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1144,17 +1244,12 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "获取订单详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "订单ID(如果提供了订单号,此参数可选)",
|
||||
"name": "id",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号(优先使用,可直接定位分表)",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
"description": "订单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1194,7 +1289,7 @@ const docTemplate = `{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "更新订单信息(主要是状态)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询",
|
||||
"description": "更新订单信息(主要是状态)。使用订单号查询(可直接定位分表)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1206,17 +1301,12 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "更新订单",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "订单ID(如果提供了订单号,此参数可选)",
|
||||
"name": "id",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号(优先使用,可直接定位分表)",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
"description": "订单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "订单状态",
|
||||
@@ -1258,7 +1348,7 @@ const docTemplate = `{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除订单及其详情。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询",
|
||||
"description": "删除订单及其详情。使用订单号查询(可直接定位分表)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1270,17 +1360,12 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "删除订单",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "订单ID(如果提供了订单号,此参数可选)",
|
||||
"name": "id",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号(优先使用,可直接定位分表)",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
"description": "订单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1807,6 +1892,159 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/payments/export": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "异步导出支付记录为CSV文件",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"支付管理"
|
||||
],
|
||||
"summary": "导出支付记录",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "支付单号",
|
||||
"name": "payment_no",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "支付方式ID",
|
||||
"name": "payment_method_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "用户ID",
|
||||
"name": "user_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "支付状态",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "开始时间",
|
||||
"name": "start_time",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "结束时间",
|
||||
"name": "end_time",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"429": {
|
||||
"description": "导出任务正在进行中",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "服务器错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/payments/export/status/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据导出记录ID查询导出任务的状态",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"支付管理"
|
||||
],
|
||||
"summary": "查询支付记录导出状态",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "导出记录ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "导出记录不存在",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "服务器错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/payments/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1814,7 +2052,7 @@ const docTemplate = `{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据ID获取支付记录详细信息",
|
||||
"description": "根据支付单号获取支付记录详细信息(分表后ID可能重复,使用支付单号查询)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1827,8 +2065,8 @@ const docTemplate = `{
|
||||
"summary": "获取支付记录详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "支付记录ID",
|
||||
"type": "string",
|
||||
"description": "支付单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
|
||||
+271
-33
@@ -692,6 +692,102 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/login": {
|
||||
"post": {
|
||||
"description": "管理员登录接口,支持用户名密码登录。如果管理员绑定了谷歌验证码,需要提供 google_code;如果未绑定但启用了图形验证码,需要提供 captcha_id 和 captcha_answer。登录成功后返回 JWT Token,Token 会同时出现在响应体的 data.token 和响应头 Authorization 中。",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"认证管理"
|
||||
],
|
||||
"summary": "管理员登录",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "用户名",
|
||||
"name": "username",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "密码(最少6位)",
|
||||
"name": "password",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "图形验证码ID(如果启用了图形验证码且未绑定谷歌验证码)",
|
||||
"name": "captcha_id",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "图形验证码答案(如果启用了图形验证码且未绑定谷歌验证码)",
|
||||
"name": "captcha_answer",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "谷歌验证码(如果绑定了谷歌验证码)",
|
||||
"name": "google_code",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "登录成功,返回 Token 和管理员信息",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误、验证码错误或谷歌验证码错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "用户名或密码错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "账号已禁用",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "服务器错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/orders": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -745,12 +841,14 @@
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最小金额",
|
||||
"name": "min_amount",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最大金额",
|
||||
"name": "max_amount",
|
||||
"in": "query"
|
||||
@@ -919,12 +1017,14 @@
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最小金额",
|
||||
"name": "min_amount",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "number",
|
||||
"format": "float64",
|
||||
"description": "最大金额",
|
||||
"name": "max_amount",
|
||||
"in": "query"
|
||||
@@ -1126,7 +1226,7 @@
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据ID或订单号获取订单详细信息,返回订单主表数据和订单详情表数据(支持分表查询)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询",
|
||||
"description": "根据订单号获取订单详细信息,返回订单主表数据和订单详情表数据(支持分表查询)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1138,17 +1238,12 @@
|
||||
],
|
||||
"summary": "获取订单详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "订单ID(如果提供了订单号,此参数可选)",
|
||||
"name": "id",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号(优先使用,可直接定位分表)",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
"description": "订单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1188,7 +1283,7 @@
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "更新订单信息(主要是状态)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询",
|
||||
"description": "更新订单信息(主要是状态)。使用订单号查询(可直接定位分表)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1200,17 +1295,12 @@
|
||||
],
|
||||
"summary": "更新订单",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "订单ID(如果提供了订单号,此参数可选)",
|
||||
"name": "id",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号(优先使用,可直接定位分表)",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
"description": "订单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "订单状态",
|
||||
@@ -1252,7 +1342,7 @@
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "删除订单及其详情。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询",
|
||||
"description": "删除订单及其详情。使用订单号查询(可直接定位分表)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1264,17 +1354,12 @@
|
||||
],
|
||||
"summary": "删除订单",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "订单ID(如果提供了订单号,此参数可选)",
|
||||
"name": "id",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号(优先使用,可直接定位分表)",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
"description": "订单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -1801,6 +1886,159 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/payments/export": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "异步导出支付记录为CSV文件",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"支付管理"
|
||||
],
|
||||
"summary": "导出支付记录",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "支付单号",
|
||||
"name": "payment_no",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "订单号",
|
||||
"name": "order_no",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "支付方式ID",
|
||||
"name": "payment_method_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "用户ID",
|
||||
"name": "user_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "支付状态",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "开始时间",
|
||||
"name": "start_time",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "结束时间",
|
||||
"name": "end_time",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"429": {
|
||||
"description": "导出任务正在进行中",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "服务器错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/payments/export/status/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据导出记录ID查询导出任务的状态",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"支付管理"
|
||||
],
|
||||
"summary": "查询支付记录导出状态",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "导出记录ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "参数错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "导出记录不存在",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "服务器错误",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/admin/payments/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -1808,7 +2046,7 @@
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据ID获取支付记录详细信息",
|
||||
"description": "根据支付单号获取支付记录详细信息(分表后ID可能重复,使用支付单号查询)",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -1821,8 +2059,8 @@
|
||||
"summary": "获取支付记录详情",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "支付记录ID",
|
||||
"type": "string",
|
||||
"description": "支付单号",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
|
||||
+183
-21
@@ -631,6 +631,72 @@ paths:
|
||||
summary: 导出管理员列表
|
||||
tags:
|
||||
- 管理员管理
|
||||
/api/admin/login:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 管理员登录接口,支持用户名密码登录。如果管理员绑定了谷歌验证码,需要提供 google_code;如果未绑定但启用了图形验证码,需要提供
|
||||
captcha_id 和 captcha_answer。登录成功后返回 JWT Token,Token 会同时出现在响应体的 data.token
|
||||
和响应头 Authorization 中。
|
||||
parameters:
|
||||
- description: 用户名
|
||||
in: body
|
||||
name: username
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: 密码(最少6位)
|
||||
in: body
|
||||
name: password
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- description: 图形验证码ID(如果启用了图形验证码且未绑定谷歌验证码)
|
||||
in: body
|
||||
name: captcha_id
|
||||
schema:
|
||||
type: string
|
||||
- description: 图形验证码答案(如果启用了图形验证码且未绑定谷歌验证码)
|
||||
in: body
|
||||
name: captcha_answer
|
||||
schema:
|
||||
type: string
|
||||
- description: 谷歌验证码(如果绑定了谷歌验证码)
|
||||
in: body
|
||||
name: google_code
|
||||
schema:
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: 登录成功,返回 Token 和管理员信息
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误、验证码错误或谷歌验证码错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"401":
|
||||
description: 用户名或密码错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"403":
|
||||
description: 账号已禁用
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"500":
|
||||
description: 服务器错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
summary: 管理员登录
|
||||
tags:
|
||||
- 认证管理
|
||||
/api/admin/orders:
|
||||
get:
|
||||
consumes:
|
||||
@@ -660,10 +726,12 @@ paths:
|
||||
name: status
|
||||
type: string
|
||||
- description: 最小金额
|
||||
format: float64
|
||||
in: query
|
||||
name: min_amount
|
||||
type: number
|
||||
- description: 最大金额
|
||||
format: float64
|
||||
in: query
|
||||
name: max_amount
|
||||
type: number
|
||||
@@ -759,15 +827,12 @@ paths:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 删除订单及其详情。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询
|
||||
description: 删除订单及其详情。使用订单号查询(可直接定位分表)
|
||||
parameters:
|
||||
- description: 订单ID(如果提供了订单号,此参数可选)
|
||||
- description: 订单号
|
||||
in: path
|
||||
name: id
|
||||
type: integer
|
||||
- description: 订单号(优先使用,可直接定位分表)
|
||||
in: query
|
||||
name: order_no
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
@@ -795,15 +860,12 @@ paths:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据ID或订单号获取订单详细信息,返回订单主表数据和订单详情表数据(支持分表查询)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询
|
||||
description: 根据订单号获取订单详细信息,返回订单主表数据和订单详情表数据(支持分表查询)
|
||||
parameters:
|
||||
- description: 订单ID(如果提供了订单号,此参数可选)
|
||||
- description: 订单号
|
||||
in: path
|
||||
name: id
|
||||
type: integer
|
||||
- description: 订单号(优先使用,可直接定位分表)
|
||||
in: query
|
||||
name: order_no
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
@@ -836,15 +898,12 @@ paths:
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 更新订单信息(主要是状态)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询
|
||||
description: 更新订单信息(主要是状态)。使用订单号查询(可直接定位分表)
|
||||
parameters:
|
||||
- description: 订单ID(如果提供了订单号,此参数可选)
|
||||
- description: 订单号
|
||||
in: path
|
||||
name: id
|
||||
type: integer
|
||||
- description: 订单号(优先使用,可直接定位分表)
|
||||
in: query
|
||||
name: order_no
|
||||
required: true
|
||||
type: string
|
||||
- description: 订单状态
|
||||
in: body
|
||||
@@ -894,10 +953,12 @@ paths:
|
||||
name: status
|
||||
type: string
|
||||
- description: 最小金额
|
||||
format: float64
|
||||
in: query
|
||||
name: min_amount
|
||||
type: number
|
||||
- description: 最大金额
|
||||
format: float64
|
||||
in: query
|
||||
name: max_amount
|
||||
type: number
|
||||
@@ -1366,13 +1427,13 @@ paths:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据ID获取支付记录详细信息
|
||||
description: 根据支付单号获取支付记录详细信息(分表后ID可能重复,使用支付单号查询)
|
||||
parameters:
|
||||
- description: 支付记录ID
|
||||
- description: 支付单号
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -1401,6 +1462,107 @@ paths:
|
||||
summary: 获取支付记录详情
|
||||
tags:
|
||||
- 支付管理
|
||||
/api/admin/payments/export:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 异步导出支付记录为CSV文件
|
||||
parameters:
|
||||
- description: 支付单号
|
||||
in: query
|
||||
name: payment_no
|
||||
type: string
|
||||
- description: 订单号
|
||||
in: query
|
||||
name: order_no
|
||||
type: string
|
||||
- description: 支付方式ID
|
||||
in: query
|
||||
name: payment_method_id
|
||||
type: integer
|
||||
- description: 用户ID
|
||||
in: query
|
||||
name: user_id
|
||||
type: integer
|
||||
- description: 支付状态
|
||||
in: query
|
||||
name: status
|
||||
type: string
|
||||
- description: 开始时间
|
||||
in: query
|
||||
name: start_time
|
||||
type: string
|
||||
- description: 结束时间
|
||||
in: query
|
||||
name: end_time
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"429":
|
||||
description: 导出任务正在进行中
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"500":
|
||||
description: 服务器错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 导出支付记录
|
||||
tags:
|
||||
- 支付管理
|
||||
/api/admin/payments/export/status/{id}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 根据导出记录ID查询导出任务的状态
|
||||
parameters:
|
||||
- description: 导出记录ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: 参数错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: 导出记录不存在
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"500":
|
||||
description: 服务器错误
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- BearerAuth: []
|
||||
summary: 查询支付记录导出状态
|
||||
tags:
|
||||
- 支付管理
|
||||
/swagger:
|
||||
get:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user