doc ✅ 修复swagger文档

This commit is contained in:
linwenxiang committed 2021-04-23 14:59:53 +08:00
1 parent 1a111f0666
commit 97d9590d05
6 files changed
+54 -159

No files matched your search

-84
View File
@@ -1,84 +0,0 @@
package sys_content
//import (
// "github.com/gin-gonic/gin"
// "github.com/gin-gonic/gin/binding"
//
// "go-admin/app/admin/models"
// "go-admin/tools"
// "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
// "github.com/go-admin-team/go-admin-core/sdk/pkg/response/msg"
//)
//
//func GetSysContentList(c *gin.Context) {
// var data models.SysContent
// var err error
// var pageSize = 10
// var pageIndex = 1
//
// if size := c.Request.FormValue("pageSize"); size != "" {
// pageSize, err = tools.StringToInt(size)
// }
// if index := c.Request.FormValue("pageIndex"); index != "" {
// pageIndex, err = tools.StringToInt(index)
// }
//
// data.CateId = c.Request.FormValue("cateId")
// data.Name = c.Request.FormValue("name")
// data.Status = c.Request.FormValue("status")
//
// data.DataScope = tools.GetUserIdStr(c)
// result, count, err := data.GetPage(pageSize, pageIndex)
// tools.HasError(err, "", -1)
//
// app.PageOK(c, result, count, pageIndex, pageSize, "")
//}
//
//func GetSysContent(c *gin.Context) {
// var data models.SysContent
// data.Id, _ = tools.StringToInt(c.Param("id"))
// result, err := data.Get()
// tools.HasError(err, "抱歉未找到相关信息", -1)
//
// app.OK(c, result, "")
//}
//
//// @Summary 添加内容管理
//// @Description 获取JSON
//// @Tags 内容管理
//// @Accept application/json
//// @Product application/json
//// @Param data body models.SysContent true "data"
//// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
//// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
//// @Router /api/v1/syscontent [post]
//func InsertSysContent(c *gin.Context) {
// var data models.SysContent
// err := c.ShouldBindJSON(&data)
// data.CreateBy = tools.GetUserIdStr(c)
// tools.HasError(err, "", 500)
// result, err := data.Create()
// tools.HasError(err, "", -1)
// app.OK(c, result, "")
//}
//
//func UpdateSysContent(c *gin.Context) {
// var data models.SysContent
// err := c.BindWith(&data, binding.JSON)
// tools.HasError(err, "数据解析失败", -1)
// data.UpdateBy = tools.GetUserIdStr(c)
// result, err := data.Update(data.Id)
// tools.HasError(err, "", -1)
//
// app.OK(c, result, "")
//}
//
//func DeleteSysContent(c *gin.Context) {
// var data models.SysContent
// data.UpdateBy = tools.GetUserIdStr(c)
//
// IDS := tools.IdsStrToIdsIntGroup("id", c)
// _, err := data.BatchDelete(IDS)
// tools.HasError(err, msg.DeletedFail, 500)
// app.OK(c, nil, msg.DeletedSuccess)
//}
+1 -22
View File
@@ -55,7 +55,7 @@ func IdentityHandler(c *gin.Context) interface{} {
// @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值
// @Accept application/json
// @Product application/json
// @Param account body system.Login true "account"
// @Param account body Login true "account"
// @Success 200 {string} string "{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": ".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A" }"
// @Router /login [post]
func Authenticator(c *gin.Context) (interface{}, error) {
@@ -149,27 +149,6 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
// @Security Bearer
func LogOut(c *gin.Context) {
LoginLogToDB(c, "2", "退出成功", user.GetUserName(c))
//var loginLog system.SysLoginLog
//loginLog.Ipaddr = c.ClientIP()
//location := pkg.GetLocation(c.ClientIP())
//loginLog.LoginLocation = location
//loginLog.LoginTime = pkg.GetCurrentTime()
//loginLog.Status = "2"
//loginLog.Remark = c.Request.UserAgent()
//browserName, browserVersion := ua.Browser()
//loginLog.Browser = browserName + " " + browserVersion
//loginLog.Os = ua.OS()
//loginLog.Platform = ua.Platform()
//loginLog.Username = user.GetUserName(c)
//loginLog.Msg = "退出成功"
//db, err := pkg.GetOrm(c)
//if err != nil {
// log.Errorf("获取Orm失败, error:%s", err)
//}
//serviceLoginLog := service.SysLoginLog{}
//serviceLoginLog.Orm = db
//_ = serviceLoginLog.InsertSysLoginLog(loginLog.Generate())
c.JSON(http.StatusOK, gin.H{
"code": 200,
"msg": "退出成功",
+19 -19
View File
@@ -1826,7 +1826,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/system.Login"
"$ref": "#/definitions/handler.Login"
}
}
],
@@ -2230,24 +2230,7 @@ var doc = `{
}
}
},
"response.Response": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"msg": {
"type": "string"
},
"requestId": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"system.Login": {
"handler.Login": {
"type": "object",
"required": [
"code",
@@ -2270,6 +2253,23 @@ var doc = `{
}
}
},
"response.Response": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"msg": {
"type": "string"
},
"requestId": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"tools.Params": {
"type": "object",
"properties": {
+19 -19
View File
@@ -1809,7 +1809,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/system.Login"
"$ref": "#/definitions/handler.Login"
}
}
],
@@ -2213,24 +2213,7 @@
}
}
},
"response.Response": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"msg": {
"type": "string"
},
"requestId": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"system.Login": {
"handler.Login": {
"type": "object",
"required": [
"code",
@@ -2253,6 +2236,23 @@
}
}
},
"response.Response": {
"type": "object",
"properties": {
"code": {
"type": "integer"
},
"msg": {
"type": "string"
},
"requestId": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"tools.Params": {
"type": "object",
"properties": {
+13 -13
View File
@@ -254,18 +254,7 @@ definitions:
username:
type: string
type: object
response.Response:
properties:
code:
type: integer
msg:
type: string
requestId:
type: string
status:
type: string
type: object
system.Login:
handler.Login:
properties:
code:
type: string
@@ -281,6 +270,17 @@ definitions:
- username
- uuid
type: object
response.Response:
properties:
code:
type: integer
msg:
type: string
requestId:
type: string
status:
type: string
type: object
tools.Params:
properties:
treeCode:
@@ -1605,7 +1605,7 @@ paths:
name: account
required: true
schema:
$ref: '#/definitions/system.Login'
$ref: '#/definitions/handler.Login'
responses:
"200":
description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token":
+2 -2
View File
@@ -4,7 +4,7 @@ import (
"go-admin/cmd"
)
//go:generate swag init --parseDependency
//go:generate swag init --parseDependency --parseDepth=6
// @title go-admin API
// @version 1.3.1
@@ -18,4 +18,4 @@ import (
// @name Authorization
func main() {
cmd.Execute()
}
}