Files
lanhongguangandClaude Sonnet 4.6 7abf306082 docs: 更新 swagger 注释适配统一响应格式 R{code,msg,data}
- 所有 @Success 改为引用 handlers.R 或 handlers.R{data=...}
- 重新生成 docs/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 17:48:02 +08:00

3162 lines
100 KiB
Go
Raw Permalink 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.
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/admin/logs/stream": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"text/event-stream"
],
"tags": [
"系统"
],
"summary": "实时日志SSE流(仅管理员)",
"responses": {
"200": {
"description": "SSE流",
"schema": {
"type": "string"
}
}
}
}
},
"/api/v1/auth/captcha": {
"get": {
"description": "返回 SVG 验证码图片和 JWT 签名答案 token",
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "获取图形验证码",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/auth/login": {
"post": {
"description": "验证用户名/密码(可选验证码),返回 JWT",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "用户登录",
"parameters": [
{
"description": "登录信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.loginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/v1/auth/me": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "返回当前登录用户及其 RBAC 角色",
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "获取当前用户信息",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/dashboard/stats": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"仪表盘"
],
"summary": "获取仪表盘统计数据",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/modems/": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "获取用户有权限的设备列表",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Modem"
}
}
}
}
]
}
}
}
}
},
"/api/v1/modems/available": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "获取所有设备(资源库)",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Modem"
}
}
}
}
]
}
}
}
}
},
"/api/v1/modems/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "获取单个设备信息",
"parameters": [
{
"type": "integer",
"description": "设备ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Modem"
}
}
}
]
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "修改设备属性",
"parameters": [
{
"type": "integer",
"description": "设备ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "修改字段",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.modemUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Modem"
}
}
}
]
}
}
}
}
},
"/api/v1/modems/{id}/detail": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "获取设备详情(含短信统计)",
"parameters": [
{
"type": "integer",
"description": "设备ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/modems/{id}/refresh": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"设备管理"
],
"summary": "手动刷新设备状态",
"parameters": [
{
"type": "integer",
"description": "设备ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Modem"
}
}
}
]
}
}
}
}
},
"/api/v1/notifications": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"通知"
],
"summary": "获取通知列表",
"parameters": [
{
"type": "integer",
"description": "每页数量",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Notification"
}
}
}
}
]
}
}
}
}
},
"/api/v1/notifications/read-all": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"通知"
],
"summary": "一键标记所有通知为已读",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/notifications/unread-count": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"通知"
],
"summary": "获取未读通知数量",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/notifications/{id}/read": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"通知"
],
"summary": "标记单条通知为已读",
"parameters": [
{
"type": "integer",
"description": "通知ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/roles/": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "获取角色列表",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Role"
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "创建角色",
"parameters": [
{
"description": "角色信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.roleBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Role"
}
}
}
]
}
}
}
}
},
"/api/v1/roles/users/{id}/roles": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "设置用户角色",
"parameters": [
{
"type": "integer",
"description": "用户ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "角色ID列表",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.setRolesBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/roles/{id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "删除角色",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "修改角色",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "修改字段",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.roleBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.Role"
}
}
}
]
}
}
}
}
},
"/api/v1/sim-requests/": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "审批员查看申请列表",
"parameters": [
{
"type": "string",
"description": "状态过滤",
"name": "status",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SimAccessRequest"
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "申请SIM卡访问权限",
"parameters": [
{
"description": "申请信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.requestCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.SimAccessRequest"
}
}
}
]
}
}
}
}
},
"/api/v1/sim-requests/batch-approve": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "批量审批通过",
"parameters": [
{
"description": "批量审批参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.batchApproveBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sim-requests/grant": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "直接授权(无需申请)",
"parameters": [
{
"description": "授权信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.directGrantBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sim-requests/grants/{id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "撤销授权",
"parameters": [
{
"type": "integer",
"description": "授权ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sim-requests/my": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "获取我的申请记录",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SimAccessRequest"
}
}
}
}
]
}
}
}
}
},
"/api/v1/sim-requests/my-grants": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "获取我的已授权列表",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SimAccessRequest"
}
}
}
}
]
}
}
}
}
},
"/api/v1/sim-requests/{id}/approve": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "批准申请",
"parameters": [
{
"type": "integer",
"description": "申请ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "批准信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.approveBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sim-requests/{id}/reject": {
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"SIM申请"
],
"summary": "拒绝申请",
"parameters": [
{
"type": "integer",
"description": "申请ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "拒绝原因",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.rejectBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sms/admin/tasks": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "管理员查看所有任务",
"parameters": [
{
"type": "integer",
"description": "按用户过滤",
"name": "user_id",
"in": "query"
},
{
"type": "string",
"description": "按状态过滤",
"name": "status",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sms/admin/tasks/stats": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "获取任务统计数据",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sms/admin/tasks/{id}/history": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "获取任务执行历史",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "返回条数",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SmsMessage"
}
}
}
}
]
}
}
}
}
},
"/api/v1/sms/messages": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "获取短信记录",
"parameters": [
{
"type": "integer",
"description": "设备ID过滤",
"name": "modem_id",
"in": "query"
},
{
"type": "string",
"description": "方向过滤(inbound/outbound)",
"name": "direction",
"in": "query"
},
{
"type": "integer",
"description": "偏移量",
"name": "skip",
"in": "query"
},
{
"type": "integer",
"description": "每页数量",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SmsMessage"
}
}
}
}
]
}
}
}
}
},
"/api/v1/sms/messages/batch-delete": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "批量删除短信记录",
"parameters": [
{
"description": "ID列表",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.batchDeleteBody"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sms/messages/{id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "删除单条短信记录",
"parameters": [
{
"type": "integer",
"description": "记录ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sms/send": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "立即发送短信",
"parameters": [
{
"description": "发送参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.smsSendRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.SmsMessage"
}
}
}
]
}
}
}
}
},
"/api/v1/sms/tasks": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "获取定时任务列表",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "创建定时任务",
"parameters": [
{
"description": "任务参数",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.taskCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.SmsScheduledTask"
}
}
}
]
}
}
}
}
},
"/api/v1/sms/tasks/{id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "删除定时任务",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "修改定时任务",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "修改字段",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.taskUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sms/tasks/{id}/run-now": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "立即执行定时任务",
"parameters": [
{
"type": "integer",
"description": "任务ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/sms/templates": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "获取短信模板列表",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SmsTemplate"
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "创建短信模板",
"parameters": [
{
"description": "模板内容",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.SmsTemplate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/models.SmsTemplate"
}
}
}
]
}
}
}
}
},
"/api/v1/sms/templates/{id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"短信"
],
"summary": "删除短信模板",
"parameters": [
{
"type": "integer",
"description": "模板ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/support/conversations": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"客服"
],
"summary": "获取所有会话列表(客服)",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/support/files/{filename}": {
"get": {
"tags": [
"客服"
],
"summary": "下载客服附件",
"parameters": [
{
"type": "string",
"description": "文件名",
"name": "filename",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
}
}
}
},
"/api/v1/support/messages": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"客服"
],
"summary": "获取客服消息记录",
"parameters": [
{
"type": "integer",
"description": "用户ID(客服用)",
"name": "user_id",
"in": "query"
},
{
"type": "integer",
"description": "增量拉取起始ID",
"name": "since_id",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SupportMessage"
}
}
}
}
]
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"客服"
],
"summary": "发送客服消息",
"parameters": [
{
"description": "消息内容",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.messageIn"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/support/messages/read": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"客服"
],
"summary": "标记消息已读",
"parameters": [
{
"type": "integer",
"description": "用户ID(客服用)",
"name": "user_id",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/support/unread": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"客服"
],
"summary": "获取未读消息数量",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/support/upload": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"客服"
],
"summary": "上传客服附件",
"parameters": [
{
"type": "file",
"description": "附件",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/telegram/config": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Telegram"
],
"summary": "获取Bot配置状态",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/telegram/file/{file_id}": {
"get": {
"tags": [
"Telegram"
],
"summary": "代理下载Telegram文件",
"parameters": [
{
"type": "string",
"description": "Telegram file_id",
"name": "file_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "JWT令牌",
"name": "token",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
}
}
}
},
"/api/v1/telegram/messages": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Telegram"
],
"summary": "获取Telegram消息记录",
"parameters": [
{
"type": "integer",
"description": "偏移量",
"name": "skip",
"in": "query"
},
{
"type": "integer",
"description": "每页数量",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handlers.R"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/models.TelegramMessage"
}
}
}
}
]
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"Telegram"
],
"summary": "清空Telegram消息记录",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/telegram/send": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Telegram"
],
"summary": "发送Telegram文字消息",
"parameters": [
{
"description": "消息内容",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.telegramSend"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/telegram/send-file": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"Telegram"
],
"summary": "向Telegram发送图片或文件",
"parameters": [
{
"type": "file",
"description": "文件",
"name": "file",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "说明文字",
"name": "caption",
"in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/users/": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "获取用户列表",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "创建用户",
"parameters": [
{
"description": "用户信息",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.userCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/users/me/change-password": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "修改当前用户密码",
"parameters": [
{
"description": "旧密码和新密码",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.passwordChange"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/users/{id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "删除用户",
"parameters": [
{
"type": "integer",
"description": "用户ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "修改用户信息",
"parameters": [
{
"type": "integer",
"description": "用户ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "修改字段",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.userUpdate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
},
"/api/v1/users/{id}/reset-password": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "管理员重置用户密码",
"parameters": [
{
"type": "integer",
"description": "用户ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "新密码",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.passwordReset"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.R"
}
}
}
}
}
},
"definitions": {
"handlers.R": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"data": {},
"msg": {
"type": "string"
}
}
},
"handlers.approveBody": {
"type": "object",
"properties": {
"admin_note": {
"type": "string"
},
"expires_at": {
"type": "string"
},
"granted_level": {
"type": "string"
}
}
},
"handlers.batchApproveBody": {
"type": "object",
"properties": {
"admin_note": {
"type": "string"
},
"expires_at": {
"type": "string"
},
"granted_level": {
"type": "string"
},
"ids": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"handlers.batchDeleteBody": {
"type": "object",
"properties": {
"ids": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"handlers.directGrantBody": {
"type": "object",
"properties": {
"admin_note": {
"type": "string"
},
"expires_at": {
"type": "string"
},
"granted_level": {
"type": "string"
},
"modem_id": {
"type": "integer"
},
"user_id": {
"type": "integer"
}
}
},
"handlers.loginRequest": {
"type": "object",
"properties": {
"captcha_code": {
"description": "用户输入的验证码答案",
"type": "string"
},
"captcha_token": {
"description": "验证码 JWT(与 captcha_code 配对)",
"type": "string"
},
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"handlers.messageIn": {
"type": "object",
"properties": {
"attachment_name": {
"type": "string"
},
"attachment_type": {
"type": "string"
},
"attachment_url": {
"type": "string"
},
"content": {
"type": "string"
},
"user_id": {
"type": "integer"
}
}
},
"handlers.modemUpdate": {
"type": "object",
"properties": {
"alias": {
"type": "string"
}
}
},
"handlers.passwordChange": {
"type": "object",
"properties": {
"new_password": {
"type": "string"
},
"old_password": {
"type": "string"
}
}
},
"handlers.passwordReset": {
"type": "object",
"properties": {
"new_password": {
"type": "string"
}
}
},
"handlers.rejectBody": {
"type": "object",
"properties": {
"admin_note": {
"type": "string"
}
}
},
"handlers.requestCreate": {
"type": "object",
"properties": {
"modem_id": {
"type": "integer"
},
"reason": {
"type": "string"
},
"requested_level": {
"type": "string"
}
}
},
"handlers.roleBody": {
"type": "object",
"properties": {
"allowed_modem_ids": {
"description": "nil=不修改,[]uint{}=清除限制",
"type": "array",
"items": {
"type": "integer"
}
},
"can_approve_requests": {
"type": "boolean"
},
"can_support": {
"type": "boolean"
},
"can_view_history": {
"type": "boolean"
},
"can_view_sim": {
"type": "boolean"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"read_only": {
"type": "boolean"
}
}
},
"handlers.setRolesBody": {
"type": "object",
"properties": {
"role_ids": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"handlers.smsSendRequest": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"modem_id": {
"type": "integer"
},
"phone_number": {
"type": "string"
}
}
},
"handlers.taskCreate": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"cron_expression": {
"type": "string"
},
"modem_id": {
"type": "integer"
},
"name": {
"type": "string"
},
"recipients": {
"type": "array",
"items": {
"type": "string"
}
},
"send_once_at": {
"type": "string"
}
}
},
"handlers.taskUpdate": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"cron_expression": {
"type": "string"
},
"name": {
"type": "string"
},
"recipients": {
"type": "array",
"items": {
"type": "string"
}
},
"send_once_at": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"handlers.telegramSend": {
"type": "object",
"properties": {
"chat_id": {
"type": "string"
},
"text": {
"type": "string"
}
}
},
"handlers.userCreate": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"role": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"handlers.userUpdate": {
"type": "object",
"properties": {
"is_active": {
"type": "boolean"
},
"role": {
"type": "string"
}
}
},
"models.Modem": {
"type": "object",
"properties": {
"access_technologies": {
"description": "接入技术,如 lte",
"type": "string"
},
"alias": {
"description": "用户自定义别名",
"type": "string"
},
"connection_duration": {
"description": "秒",
"type": "integer"
},
"created_at": {
"type": "string"
},
"current_bands": {
"type": "string"
},
"current_modes": {
"type": "string"
},
"device_path": {
"description": "设备节点,如 ttyUSB0",
"type": "string"
},
"firmware_revision": {
"type": "string"
},
"hardware_revision": {
"type": "string"
},
"iccid": {
"type": "string"
},
"id": {
"type": "integer"
},
"imei": {
"description": "IMEI,可能为空",
"type": "string"
},
"imsi": {
"type": "string"
},
"is_active": {
"description": "false 表示设备已拔出",
"type": "boolean"
},
"last_seen": {
"type": "string"
},
"manufacturer": {
"type": "string"
},
"mm_object_path": {
"description": "唯一键",
"type": "string"
},
"model": {
"type": "string"
},
"operator": {
"description": "运营商名称",
"type": "string"
},
"phone_number": {
"type": "string"
},
"plugin": {
"description": "mmcli 插件名",
"type": "string"
},
"ports": {
"type": "string"
},
"registration_state": {
"type": "string"
},
"rx_bytes": {
"type": "integer"
},
"signal_quality": {
"description": "信号质量 0-100",
"type": "integer"
},
"sim_operator_code": {
"description": "MCC+MNC",
"type": "string"
},
"sim_operator_name": {
"description": "SIM 卡归属运营商名",
"type": "string"
},
"status": {
"type": "string"
},
"tx_bytes": {
"type": "integer"
}
}
},
"models.Notification": {
"type": "object",
"properties": {
"audience": {
"description": "受众:admin/support/all/user",
"type": "string"
},
"body": {
"description": "通知正文",
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"is_read": {
"type": "boolean"
},
"target_user_id": {
"description": "audience=user 时指定目标用户",
"type": "integer"
},
"title": {
"type": "string"
},
"type": {
"description": "通知类型,如 sms_failed",
"type": "string"
}
}
},
"models.Role": {
"type": "object",
"properties": {
"can_approve_requests": {
"description": "可审批 SIM 卡申请",
"type": "boolean"
},
"can_support": {
"description": "可访问客服功能",
"type": "boolean"
},
"can_view_history": {
"description": "可查看短信记录",
"type": "boolean"
},
"can_view_sim": {
"description": "可查看 SIM 卡列表",
"type": "boolean"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"is_system": {
"description": "系统预置角色,不允许删除",
"type": "boolean"
},
"name": {
"type": "string"
},
"read_only": {
"description": "只读(不可发送短信/创建任务)",
"type": "boolean"
},
"updated_at": {
"type": "string"
}
}
},
"models.SimAccessRequest": {
"type": "object",
"properties": {
"admin_note": {
"description": "审批备注(可选)",
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"modem_id": {
"type": "integer"
},
"reason": {
"description": "申请理由(可选)",
"type": "string"
},
"requested_level": {
"description": "view 或 use",
"type": "string"
},
"status": {
"description": "pending/approved/rejected",
"type": "string"
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "integer"
}
}
},
"models.SmsMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
"created_by_id": {
"description": "发送人",
"type": "integer"
},
"direction": {
"description": "inbound/outbound",
"type": "string"
},
"error_message": {
"description": "发送失败原因",
"type": "string"
},
"id": {
"type": "integer"
},
"mm_sms_index": {
"description": "mmcli SMS 对象索引,用于去重",
"type": "string"
},
"modem_id": {
"type": "integer"
},
"phone_number": {
"description": "对端号码",
"type": "string"
},
"received_at": {
"type": "string"
},
"scheduled_task_id": {
"description": "关联的定时任务(手动发送时为 nil)",
"type": "integer"
},
"sent_at": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"models.SmsScheduledTask": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
"created_by_id": {
"type": "integer"
},
"cron_expression": {
"description": "与 SendOnceAt 二选一",
"type": "string"
},
"id": {
"type": "integer"
},
"last_run_at": {
"type": "string"
},
"modem_id": {
"type": "integer"
},
"name": {
"type": "string"
},
"next_run_at": {
"type": "string"
},
"recipients": {
"description": "收件人号码列表",
"type": "array",
"items": {
"type": "string"
}
},
"run_count": {
"type": "integer"
},
"send_once_at": {
"description": "一次性发送时间(UTC)",
"type": "string"
},
"status": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"models.SmsTemplate": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"variables": {
"description": "变量名列表,如 [\"姓名\", \"金额\"]",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"models.SupportMessage": {
"type": "object",
"properties": {
"attachment_name": {
"type": "string"
},
"attachment_type": {
"description": "\"image\" 或 \"file\"",
"type": "string"
},
"attachment_url": {
"type": "string"
},
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"is_from_user": {
"description": "true=用户,false=客服",
"type": "boolean"
},
"is_read": {
"type": "boolean"
},
"sender_id": {
"description": "实际发送者",
"type": "integer"
},
"user_id": {
"description": "会话归属用户",
"type": "integer"
}
}
},
"models.TelegramMessage": {
"type": "object",
"properties": {
"chat_id": {
"type": "string"
},
"created_at": {
"type": "string"
},
"direction": {
"description": "in / out",
"type": "string"
},
"file_id": {
"description": "Telegram 文件 ID",
"type": "string"
},
"file_type": {
"description": "photo/document/video 等",
"type": "string"
},
"id": {
"type": "integer"
},
"is_command": {
"description": "是否为 Bot 命令",
"type": "boolean"
},
"text": {
"type": "string"
},
"username": {
"description": "发送人用户名(收件时有效)",
"type": "string"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "格式: Bearer {token}",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8000",
BasePath: "/",
Schemes: []string{},
Title: "SimNexus API",
Description: "多USB 4G Modem 管理系统 API",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}