Files
server/docs/swagger.yaml
T
2026-01-16 15:49:34 +08:00

1424 lines
36 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
basePath: /api/admin
definitions:
admin.AdminDetailResponse:
properties:
code:
description: 状态码
example: 200
type: integer
data:
allOf:
- $ref: '#/definitions/admin.AdminResponse'
description: 管理员数据
message:
description: 消息
example: 获取成功
type: string
trace_id:
description: 追踪ID
example: abc123
type: string
type: object
admin.AdminExportRequest:
properties:
department_id:
description: 部门ID
example: "1"
type: string
end_time:
description: 结束时间
example: "2024-12-31 23:59:59"
type: string
is_2fa_bound:
description: 是否绑定2FA1-已绑定,0-未绑定
example: "1"
type: string
order_by:
description: 排序
example: created_at:desc
type: string
role_id:
description: 角色ID
example: "1"
type: string
start_time:
description: 开始时间
example: "2024-01-01 00:00:00"
type: string
status:
description: 状态:1-启用,0-禁用
example: "1"
type: string
username:
description: 用户名(模糊搜索)
example: admin
type: string
type: object
admin.AdminResponse:
properties:
avatar:
description: 头像
example: ""
type: string
created_at:
description: 创建时间
example: "2024-01-01 00:00:00"
type: string
department:
additionalProperties: {}
description: 部门信息
type: object
department_id:
description: 部门ID
example: 1
type: integer
email:
description: 邮箱
example: admin@example.com
type: string
id:
description: 管理员ID
example: 1
type: integer
is_2fa_bound:
description: 是否绑定2FA
example: true
type: boolean
nickname:
description: 昵称
example: 管理员
type: string
phone:
description: 手机号
example: "13800138000"
type: string
roles:
description: 角色列表
items:
additionalProperties: {}
type: object
type: array
status:
description: 状态:1-启用,0-禁用
example: 1
type: integer
updated_at:
description: 更新时间
example: "2024-01-01 00:00:00"
type: string
username:
description: 用户名
example: admin
type: string
type: object
admin.OrderProductItem:
properties:
price:
description: 单价
example: 99.99
type: number
product_id:
description: 商品ID
example: 1
type: integer
product_name:
description: 商品名称
example: 商品名称
type: string
quantity:
description: 数量
example: 2
type: integer
required:
- price
- product_id
- product_name
- quantity
type: object
admin.PaginatedAdminResponse:
properties:
code:
description: 状态码
example: 200
type: integer
data:
description: 数据列表
items:
$ref: '#/definitions/admin.AdminResponse'
type: array
message:
description: 消息
example: 获取成功
type: string
page:
description: 当前页码
example: 1
type: integer
page_size:
description: 每页数量
example: 10
type: integer
total:
description: 总数
example: 100
type: integer
trace_id:
description: 追踪ID
example: abc123
type: string
type: object
host: localhost:3000
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: 这是一个基于 Goravel 框架的后台管理系统 API 文档
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: Goravel Admin API
version: "1.0"
paths:
/api/admin/admins:
get:
consumes:
- application/json
description: 分页获取管理员列表,支持按用户名、状态、角色、部门等条件筛选
parameters:
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页数量
in: query
name: page_size
type: integer
- description: 用户名(模糊搜索)
in: query
name: username
type: string
- description: 状态:1-启用,0-禁用
in: query
name: status
type: string
- description: 角色ID
in: query
name: role_id
type: string
- description: 部门ID
in: query
name: department_id
type: string
- description: 开始时间(格式:YYYY-MM-DD HH:mm:ss
in: query
name: start_time
type: string
- description: 结束时间(格式:YYYY-MM-DD HH:mm:ss
in: query
name: end_time
type: string
- description: 排序(格式:字段:asc/desc,如:created_at:desc
in: query
name: order_by
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/admin.PaginatedAdminResponse'
"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
security:
- BearerAuth: []
summary: 获取管理员列表
tags:
- 管理员管理
post:
consumes:
- application/json
description: 创建新的管理员账号,支持设置部门、角色等信息
parameters:
- description: 用户名(必填)
example: admin
in: body
name: username
required: true
schema:
type: string
- description: 密码(必填)
example: "123456"
in: body
name: password
required: true
schema:
type: string
- description: 昵称
example: 管理员
in: body
name: nickname
schema:
type: string
- description: 邮箱
example: admin@example.com
in: body
name: email
schema:
type: string
- description: 手机号
example: "13800138000"
in: body
name: phone
schema:
type: string
- description: 部门ID
example: 1
in: body
name: department_id
schema:
type: integer
- description: 状态:1-启用,0-禁用
example: 1
in: body
name: status
schema:
type: integer
- description: 角色ID列表
in: body
name: role_ids
schema:
items:
type: integer
type: array
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/admin.AdminDetailResponse'
"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
security:
- BearerAuth: []
summary: 创建管理员
tags:
- 管理员管理
/api/admin/admins/{id}:
delete:
consumes:
- application/json
description: 删除指定的管理员账号。受保护的管理员和当前登录的管理员不能删除。
parameters:
- description: 管理员ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 删除成功
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
"404":
description: 管理员不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 删除管理员
tags:
- 管理员管理
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:
$ref: '#/definitions/admin.AdminDetailResponse'
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未登录
schema:
additionalProperties: true
type: object
"403":
description: 无权限
schema:
additionalProperties: true
type: object
"404":
description: 管理员不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 获取管理员详情
tags:
- 管理员管理
put:
consumes:
- application/json
description: 更新管理员的基本信息,包括昵称、邮箱、手机号、部门、状态、角色等。受保护的管理员不能禁用。
parameters:
- description: 管理员ID
example: 1
in: path
name: id
required: true
type: integer
- description: 昵称
example: 管理员
in: body
name: nickname
schema:
type: string
- description: 邮箱
example: admin@example.com
in: body
name: email
schema:
type: string
- description: 手机号
example: "13800138000"
in: body
name: phone
schema:
type: string
- description: 部门ID
example: 1
in: body
name: department_id
schema:
type: integer
- description: 状态:1-启用,0-禁用
example: "1"
in: body
name: status
schema:
type: string
- description: 密码(可选,不传则不更新)
example: "123456"
in: body
name: password
schema:
type: string
- description: 角色ID列表
in: body
name: role_ids
schema:
items:
type: integer
type: array
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/admin.AdminDetailResponse'
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未登录
schema:
additionalProperties: true
type: object
"403":
description: 无权限或受保护管理员不能禁用
schema:
additionalProperties: true
type: object
"404":
description: 管理员不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 更新管理员信息
tags:
- 管理员管理
/api/admin/admins/{id}/unbind-google-auth:
post:
consumes:
- application/json
description: 管理员可以解绑其他管理员的谷歌验证码,需要当前管理员已绑定谷歌验证码并输入验证码确认
parameters:
- description: 要解绑的管理员ID
in: path
name: id
required: true
type: integer
- description: 当前管理员的谷歌验证码
in: body
name: code
required: true
schema:
type: string
produces:
- application/json
responses:
"200":
description: 解绑成功
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
"404":
description: 管理员不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 解绑管理员的谷歌验证码
tags:
- 管理员管理
/api/admin/admins/export:
post:
consumes:
- application/json
description: 根据筛选条件导出管理员列表为CSV文件,支持与列表查询相同的筛选条件
parameters:
- description: 导出筛选条件(可选)
in: body
name: request
schema:
$ref: '#/definitions/admin.AdminExportRequest'
produces:
- application/json
responses:
"200":
description: 导出成功,返回文件下载信息
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
security:
- BearerAuth: []
summary: 导出管理员列表
tags:
- 管理员管理
/api/admin/orders:
get:
consumes:
- application/json
description: 分页获取订单列表,支持多条件筛选,查询时间范围不能超过3个月
parameters:
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页数量
in: query
name: page_size
type: integer
- description: 用户ID
in: query
name: user_id
type: integer
- description: 订单号(模糊搜索)
in: query
name: order_no
type: string
- description: 订单状态(pending/paid/cancelled
in: query
name: status
type: string
- description: 最小金额
in: query
name: min_amount
type: number
- description: 最大金额
in: query
name: max_amount
type: number
- description: 开始时间(格式:2006-01-02 15:04:05
in: query
name: start_time
type: string
- description: 结束时间(格式:2006-01-02 15:04:05
in: query
name: end_time
type: string
- description: 排序(格式:字段:asc/desc,如:created_at:desc
in: query
name: order_by
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 获取订单列表
tags:
- 订单管理
post:
consumes:
- application/json
description: 创建新订单,自动防止重复提交
parameters:
- description: 用户ID
in: body
name: user_id
required: true
schema:
type: integer
- description: 订单金额
in: body
name: amount
required: true
schema:
type: number
- description: 商品列表
in: body
name: products
required: true
schema:
items:
$ref: '#/definitions/admin.OrderProductItem'
type: array
- description: 请求ID(用于防重复提交,不传则自动生成)
in: body
name: request_id
schema:
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误或重复提交
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 创建订单
tags:
- 订单管理
/api/admin/orders/{id}:
delete:
consumes:
- application/json
description: 删除订单及其详情。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询
parameters:
- description: 订单ID(如果提供了订单号,此参数可选)
in: path
name: id
type: integer
- description: 订单号(优先使用,可直接定位分表)
in: query
name: order_no
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 删除订单
tags:
- 订单管理
get:
consumes:
- application/json
description: 根据ID或订单号获取订单详细信息,返回订单主表数据和订单详情表数据(支持分表查询)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询
parameters:
- description: 订单ID(如果提供了订单号,此参数可选)
in: path
name: id
type: integer
- description: 订单号(优先使用,可直接定位分表)
in: query
name: order_no
type: string
produces:
- application/json
responses:
"200":
description: 返回数据包含 order(订单主表)和 details(订单详情表数组)
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:
- 订单管理
put:
consumes:
- application/json
description: 更新订单信息(主要是状态)。优先使用订单号查询(更高效),如果没有订单号则使用订单ID查询
parameters:
- description: 订单ID(如果提供了订单号,此参数可选)
in: path
name: id
type: integer
- description: 订单号(优先使用,可直接定位分表)
in: query
name: order_no
type: string
- description: 订单状态
in: body
name: status
required: true
schema:
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 更新订单
tags:
- 订单管理
/api/admin/orders/export:
post:
consumes:
- application/json
description: 根据筛选条件导出订单列表为CSV文件,支持与列表查询相同的筛选条件,查询时间范围不能超过3个月
parameters:
- description: 用户ID
in: query
name: user_id
type: integer
- description: 订单号(模糊搜索)
in: query
name: order_no
type: string
- description: 订单状态(pending/paid/cancelled
in: query
name: status
type: string
- description: 最小金额
in: query
name: min_amount
type: number
- description: 最大金额
in: query
name: max_amount
type: number
- description: 开始时间(格式:2006-01-02 15:04:05
in: query
name: start_time
type: string
- description: 结束时间(格式:2006-01-02 15:04:05
in: query
name: end_time
type: string
- description: 排序(格式:字段:asc/desc,如:created_at:desc
in: query
name: order_by
type: string
produces:
- application/json
responses:
"200":
description: 导出成功,返回文件下载信息
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
security:
- BearerAuth: []
summary: 导出订单列表
tags:
- 订单管理
/api/admin/orders/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
"401":
description: 未登录
schema:
additionalProperties: true
type: object
"403":
description: 无权限
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 查询导出状态
tags:
- 订单管理
/api/admin/orders/import:
post:
consumes:
- multipart/form-data
description: 从CSV文件导入订单数据,支持批量导入
parameters:
- description: CSV文件
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: 导入成功,返回导入结果
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
security:
- BearerAuth: []
summary: 导入订单
tags:
- 订单管理
/api/admin/payment-methods:
get:
consumes:
- application/json
description: 分页获取支付方式列表,支持多条件筛选
parameters:
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页数量
in: query
name: page_size
type: integer
- description: 支付方式名称(模糊搜索)
in: query
name: name
type: string
- description: 支付方式代码
in: query
name: code
type: string
- description: 支付类型
in: query
name: type
type: string
- description: 是否启用:1-启用,0-禁用
in: query
name: is_active
type: string
- description: 排序(格式:字段:asc/desc,如:created_at:desc
in: query
name: order_by
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 获取支付方式列表
tags:
- 支付管理
post:
consumes:
- application/json
description: 创建新的支付方式
parameters:
- description: 支付方式名称
in: body
name: name
required: true
schema:
type: string
- description: 支付方式代码
in: body
name: code
required: true
schema:
type: string
- description: 支付类型
in: body
name: type
required: true
schema:
type: string
- description: 支付配置(JSON对象)
in: body
name: config
required: true
schema:
type: object
- description: 是否启用
in: body
name: is_active
schema:
type: boolean
- description: 排序
in: body
name: sort
schema:
type: integer
- description: 描述
in: body
name: description
schema:
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 创建支付方式
tags:
- 支付管理
/api/admin/payment-methods/{id}:
delete:
consumes:
- application/json
description: 删除支付方式
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
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 删除支付方式
tags:
- 支付管理
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:
- 支付管理
put:
consumes:
- application/json
description: 更新支付方式信息
parameters:
- description: 支付方式ID
in: path
name: id
required: true
type: integer
- description: 支付方式名称
in: body
name: name
required: true
schema:
type: string
- description: 支付配置(JSON对象)
in: body
name: config
schema:
type: object
- description: 是否启用
in: body
name: is_active
schema:
type: boolean
- description: 排序
in: body
name: sort
schema:
type: integer
- description: 描述
in: body
name: description
schema:
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 更新支付方式
tags:
- 支付管理
/api/admin/payments:
get:
consumes:
- application/json
description: 分页获取支付记录列表,支持多条件筛选
parameters:
- default: 1
description: 页码
in: query
name: page
type: integer
- default: 10
description: 每页数量
in: query
name: page_size
type: integer
- 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: 支付状态(pending/paid/failed/cancelled
in: query
name: status
type: string
- description: 开始时间(格式:2006-01-02 15:04:05
in: query
name: start_time
type: string
- description: 结束时间(格式:2006-01-02 15:04:05
in: query
name: end_time
type: string
- description: 排序(格式:字段:asc/desc,如:created_at:desc
in: query
name: order_by
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"400":
description: 参数错误
schema:
additionalProperties: true
type: object
"500":
description: 服务器错误
schema:
additionalProperties: true
type: object
security:
- BearerAuth: []
summary: 获取支付记录列表
tags:
- 支付管理
/api/admin/payments/{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:
- application/json
description: Description
responses:
"200":
description: OK
"400":
description: Bad Request
summary: Summary
tags:
- example
securityDefinitions:
BearerAuth:
description: JWT 认证,格式:Bearer {token}
in: header
name: Authorization
type: apiKey
swagger: "2.0"