doc ✅ 修复swagger文档
This commit is contained in:
1 parent
1a111f0666
commit
97d9590d05
6 files changed
+53
-158
No files matched your search
@@ -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)
|
|
||||||
//}
|
|
||||||
@@ -55,7 +55,7 @@ func IdentityHandler(c *gin.Context) interface{} {
|
|||||||
// @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值
|
// @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值
|
||||||
// @Accept application/json
|
// @Accept application/json
|
||||||
// @Product 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" }"
|
// @Success 200 {string} string "{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": ".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A" }"
|
||||||
// @Router /login [post]
|
// @Router /login [post]
|
||||||
func Authenticator(c *gin.Context) (interface{}, error) {
|
func Authenticator(c *gin.Context) (interface{}, error) {
|
||||||
@@ -149,27 +149,6 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
|
|||||||
// @Security Bearer
|
// @Security Bearer
|
||||||
func LogOut(c *gin.Context) {
|
func LogOut(c *gin.Context) {
|
||||||
LoginLogToDB(c, "2", "退出成功", user.GetUserName(c))
|
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{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"code": 200,
|
"code": 200,
|
||||||
"msg": "退出成功",
|
"msg": "退出成功",
|
||||||
|
|||||||
+19
-19
@@ -1826,7 +1826,7 @@ var doc = `{
|
|||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/system.Login"
|
"$ref": "#/definitions/handler.Login"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -2230,24 +2230,7 @@ var doc = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response.Response": {
|
"handler.Login": {
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"code": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"msg": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"requestId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"system.Login": {
|
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"code",
|
"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": {
|
"tools.Params": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
+19
-19
@@ -1809,7 +1809,7 @@
|
|||||||
"in": "body",
|
"in": "body",
|
||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"$ref": "#/definitions/system.Login"
|
"$ref": "#/definitions/handler.Login"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -2213,24 +2213,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"response.Response": {
|
"handler.Login": {
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"code": {
|
|
||||||
"type": "integer"
|
|
||||||
},
|
|
||||||
"msg": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"requestId": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"system.Login": {
|
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"code",
|
"code",
|
||||||
@@ -2253,6 +2236,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"response.Response": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"msg": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"requestId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"tools.Params": {
|
"tools.Params": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
+13
-13
@@ -254,18 +254,7 @@ definitions:
|
|||||||
username:
|
username:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
response.Response:
|
handler.Login:
|
||||||
properties:
|
|
||||||
code:
|
|
||||||
type: integer
|
|
||||||
msg:
|
|
||||||
type: string
|
|
||||||
requestId:
|
|
||||||
type: string
|
|
||||||
status:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
system.Login:
|
|
||||||
properties:
|
properties:
|
||||||
code:
|
code:
|
||||||
type: string
|
type: string
|
||||||
@@ -281,6 +270,17 @@ definitions:
|
|||||||
- username
|
- username
|
||||||
- uuid
|
- uuid
|
||||||
type: object
|
type: object
|
||||||
|
response.Response:
|
||||||
|
properties:
|
||||||
|
code:
|
||||||
|
type: integer
|
||||||
|
msg:
|
||||||
|
type: string
|
||||||
|
requestId:
|
||||||
|
type: string
|
||||||
|
status:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
tools.Params:
|
tools.Params:
|
||||||
properties:
|
properties:
|
||||||
treeCode:
|
treeCode:
|
||||||
@@ -1605,7 +1605,7 @@ paths:
|
|||||||
name: account
|
name: account
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/system.Login'
|
$ref: '#/definitions/handler.Login'
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token":
|
description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token":
|
||||||
|
|||||||
Reference in new issue
Block a user