You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1139 lines
38 KiB

// 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支持",
"url": "http://www.gofaster.com/support",
"email": "support@gofaster.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/auth/admin/users": {
"get": {
"description": "获取分页用户列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "获取用户列表",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "每页数量",
"name": "pageSize",
"in": "query"
}
],
"responses": {
"200": {
"description": "用户列表",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "请求参数错误",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/auth/admin/users/{id}": {
"get": {
"description": "根据ID获取用户详情",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "获取用户详情",
"parameters": [
{
"type": "integer",
"description": "用户ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "用户信息",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "无效的用户ID",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "用户不存在",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"put": {
"description": "根据ID更新用户信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "更新用户信息",
"parameters": [
{
"type": "integer",
"description": "用户ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "用户信息",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.User"
}
}
],
"responses": {
"200": {
"description": "更新后的用户信息",
"schema": {
"$ref": "#/definitions/model.User"
}
},
"400": {
"description": "无效的用户ID或请求参数",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "用户不存在",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"delete": {
"description": "根据ID删除用户",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"用户管理"
],
"summary": "删除用户",
"parameters": [
{
"type": "integer",
"description": "用户ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "删除成功"
},
"400": {
"description": "无效的用户ID",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "用户不存在",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/auth/captcha": {
"get": {
"description": "生成图形验证码,用于登录验证",
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "生成验证码",
"responses": {
"200": {
"description": "验证码生成成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.CaptchaResponse"
}
}
}
]
}
}
}
}
},
"/auth/login": {
"post": {
"description": "用户登录接口,支持验证码验证和密码错误次数限制",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "用户登录",
"parameters": [
{
"description": "登录请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "登录成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.LoginResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"401": {
"description": "认证失败",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"423": {
"description": "账户被锁定",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/auth/logout": {
"post": {
"description": "用户登出接口",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "用户登出",
"parameters": [
{
"description": "登出请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.LogoutRequest"
}
}
],
"responses": {
"200": {
"description": "登出成功",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/auth/refresh": {
"post": {
"description": "使用刷新令牌获取新的访问令牌",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "刷新访问令牌",
"parameters": [
{
"description": "刷新令牌请求参数",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.RefreshTokenRequest"
}
}
],
"responses": {
"200": {
"description": "刷新成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.LoginResponse"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"401": {
"description": "刷新令牌无效",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/auth/roles": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "分页获取角色列表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "获取角色列表",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "页码",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "每页数量",
"name": "pageSize",
"in": "query"
}
],
"responses": {
"200": {
"description": "获取成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Role"
}
},
"page": {
"type": "integer"
},
"size": {
"type": "integer"
},
"total": {
"type": "integer"
}
}
}
}
}
]
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "创建新的角色",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "创建角色",
"parameters": [
{
"description": "角色信息",
"name": "role",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.Role"
}
}
],
"responses": {
"200": {
"description": "创建成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Role"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/auth/roles/{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": "获取成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Role"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"404": {
"description": "角色不存在",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "根据ID更新角色信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"角色管理"
],
"summary": "更新角色",
"parameters": [
{
"type": "integer",
"description": "角色ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "角色信息",
"name": "role",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/model.Role"
}
}
],
"responses": {
"200": {
"description": "更新成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.Role"
}
}
}
]
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
},
"delete": {
"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": "删除成功",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"400": {
"description": "请求参数错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"500": {
"description": "服务器内部错误",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
},
"/auth/userinfo": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "获取当前登录用户的详细信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"认证"
],
"summary": "获取用户信息",
"responses": {
"200": {
"description": "获取成功",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/model.UserInfo"
}
}
}
]
}
},
"401": {
"description": "未授权",
"schema": {
"$ref": "#/definitions/response.Response"
}
}
}
}
}
},
"definitions": {
"model.CaptchaResponse": {
"type": "object",
"properties": {
"captcha_id": {
"type": "string"
},
"captcha_image": {
"description": "Base64编码的图片",
"type": "string"
},
"expires_in": {
"type": "integer"
}
}
},
"model.LoginRequest": {
"type": "object",
"required": [
"captcha",
"captcha_id",
"password",
"username"
],
"properties": {
"captcha": {
"type": "string"
},
"captcha_id": {
"type": "string"
},
"client_ip": {
"description": "客户端IP地址",
"type": "string"
},
"password": {
"type": "string",
"maxLength": 100,
"minLength": 6
},
"username": {
"type": "string",
"maxLength": 50,
"minLength": 3
}
}
},
"model.LoginResponse": {
"type": "object",
"properties": {
"expires_in": {
"type": "integer"
},
"force_change_password": {
"description": "是否需要强制修改密码",
"type": "boolean"
},
"refresh_token": {
"type": "string"
},
"token": {
"type": "string"
},
"token_type": {
"type": "string"
},
"user": {
"$ref": "#/definitions/model.UserInfo"
}
}
},
"model.LogoutRequest": {
"type": "object",
"required": [
"token"
],
"properties": {
"token": {
"type": "string"
}
}
},
"model.Permission": {
"type": "object",
"properties": {
"action": {
"description": "create, read, update, delete等",
"type": "string"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"resource": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"model.PermissionInfo": {
"type": "object",
"properties": {
"action": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"resource": {
"type": "string"
}
}
},
"model.RefreshTokenRequest": {
"type": "object",
"required": [
"refresh_token"
],
"properties": {
"refresh_token": {
"type": "string"
}
}
},
"model.Role": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"permissions": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Permission"
}
},
"updated_at": {
"type": "string"
}
}
},
"model.RoleInfo": {
"type": "object",
"properties": {
"code": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"permissions": {
"type": "array",
"items": {
"$ref": "#/definitions/model.PermissionInfo"
}
}
}
},
"model.User": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"force_change_password": {
"description": "是否强制修改密码",
"type": "boolean"
},
"id": {
"type": "integer"
},
"last_login_at": {
"description": "最后登录时间",
"type": "string"
},
"last_login_ip": {
"description": "最后登录IP",
"type": "string"
},
"password_changed_at": {
"description": "密码最后修改时间",
"type": "string"
},
"phone": {
"type": "string"
},
"roles": {
"type": "array",
"items": {
"$ref": "#/definitions/model.Role"
}
},
"status": {
"description": "1-正常 2-禁用 3-锁定",
"type": "integer"
},
"updated_at": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"model.UserInfo": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"id": {
"type": "integer"
},
"last_login_at": {
"type": "string"
},
"last_login_ip": {
"type": "string"
},
"phone": {
"type": "string"
},
"roles": {
"type": "array",
"items": {
"$ref": "#/definitions/model.RoleInfo"
}
},
"status": {
"type": "integer"
},
"username": {
"type": "string"
}
}
},
"response.Response": {
"type": "object",
"properties": {
"code": {
"description": "响应状态码",
"type": "integer"
},
"data": {
"description": "响应数据"
},
"error": {
"description": "错误信息",
"type": "string"
},
"message": {
"description": "响应消息",
"type": "string"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"description": "请输入 \"Bearer \" + JWT token,例如: \"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"",
"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{"http"},
Title: "GoFaster API",
Description: "GoFaster项目API文档",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}