优化工作-1

This commit is contained in:
yml2213
2026-06-05 07:41:52 +08:00
parent b7ec5e2755
commit 0b9b0b5ea7
17 changed files with 1807 additions and 127 deletions
+276
View File
@@ -0,0 +1,276 @@
// 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}}",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"name": "API Support",
"email": "support@hfb.com"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/auth/logout": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "用户登出(客户端需清除本地 token)",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "登出",
"responses": {
"200": {
"description": "登出成功",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
}
}
}
},
"/auth/refresh": {
"post": {
"description": "使用 refresh_token 获取新的 access_token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "刷新访问令牌",
"parameters": [
{
"description": "刷新令牌",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_modules_auth.RefreshRequest"
}
}
],
"responses": {
"200": {
"description": "刷新成功,返回新的 token",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
},
"401": {
"description": "refresh_token 无效",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
}
}
}
},
"/auth/sms/login": {
"post": {
"description": "使用手机号和验证码登录",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "短信验证码登录",
"parameters": [
{
"description": "登录信息",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_modules_auth.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "登录成功,返回用户信息和 token",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
},
"401": {
"description": "验证码错误",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
},
"500": {
"description": "服务器错误",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
}
}
}
},
"/auth/sms/send": {
"post": {
"description": "发送登录验证码到指定手机号",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "发送短信验证码",
"parameters": [
{
"description": "手机号",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/internal_modules_auth.SendSMSRequest"
}
}
],
"responses": {
"200": {
"description": "发送成功",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
},
"500": {
"description": "服务器错误",
"schema": {
"$ref": "#/definitions/hfb_sys_backend_pkg_response.Body"
}
}
}
}
}
},
"definitions": {
"hfb_sys_backend_pkg_response.Body": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"data": {},
"message": {
"type": "string"
}
}
},
"internal_modules_auth.LoginRequest": {
"type": "object",
"required": [
"code",
"phone"
],
"properties": {
"code": {
"type": "string"
},
"phone": {
"type": "string"
}
}
},
"internal_modules_auth.RefreshRequest": {
"type": "object",
"required": [
"refresh_token"
],
"properties": {
"refresh_token": {
"type": "string"
}
}
},
"internal_modules_auth.SendSMSRequest": {
"type": "object",
"required": [
"phone"
],
"properties": {
"phone": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "Type \"Bearer\" followed by a space and JWT 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:8080",
BasePath: "/api",
Schemes: []string{},
Title: "HFB Sys API",
Description: "哈夫币租号平台 API 文档",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}