From 091e6de0399c1250c78159804b9f8569448d6fe7 Mon Sep 17 00:00:00 2001 From: klausY Date: Fri, 13 Dec 2019 14:28:23 +0800 Subject: [PATCH] =?UTF-8?q?swagger=20=E8=BF=8E=E5=90=88=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BF=AE=E6=94=B9json=20=E4=B8=BAstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/exa_fileUploadAndDownload.go | 6 +++--- QMPlusServer/controller/api/sys_api.go | 12 +++++------ QMPlusServer/controller/api/sys_authority.go | 14 ++++++------- QMPlusServer/controller/api/sys_casbin.go | 17 ++++++++-------- QMPlusServer/controller/api/sys_menu.go | 20 +++++++++---------- QMPlusServer/controller/api/sys_user.go | 14 ++++++------- QMPlusServer/controller/api/sys_workFlow.go | 2 +- QMPlusServer/docs/docs.go | 2 +- QMPlusServer/static/dbconfig/config.json | 2 +- 9 files changed, 43 insertions(+), 46 deletions(-) diff --git a/QMPlusServer/controller/api/exa_fileUploadAndDownload.go b/QMPlusServer/controller/api/exa_fileUploadAndDownload.go index 9c29aaa2..e67ca0d3 100644 --- a/QMPlusServer/controller/api/exa_fileUploadAndDownload.go +++ b/QMPlusServer/controller/api/exa_fileUploadAndDownload.go @@ -15,7 +15,7 @@ import ( // @accept multipart/form-data // @Produce application/json // @Param file formData file true "上传文件示例" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"上传成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}" // @Router /fileUploadAndDownload/upload [post] func UploadFile(c *gin.Context) { _, header, err := c.Request.FormFile("file") @@ -49,7 +49,7 @@ func UploadFile(c *gin.Context) { // @Security ApiKeyAuth // @Produce application/json // @Param data body dbModel.ExaFileUploadAndDownload true "传入文件里面id即可" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"返回成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /fileUploadAndDownload/deleteFile [post] func DeleteFile(c *gin.Context) { var file dbModel.ExaFileUploadAndDownload @@ -78,7 +78,7 @@ func DeleteFile(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body modelInterface.PageInfo true "分页获取文件户列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /fileUploadAndDownload/getFileList [post] func GetFileList(c *gin.Context) { var pageInfo modelInterface.PageInfo diff --git a/QMPlusServer/controller/api/sys_api.go b/QMPlusServer/controller/api/sys_api.go index 19aae1b7..efc05927 100644 --- a/QMPlusServer/controller/api/sys_api.go +++ b/QMPlusServer/controller/api/sys_api.go @@ -23,7 +23,7 @@ type DeleteApiParams struct { // @accept application/json // @Produce application/json // @Param data body api.CreateApiParams true "创建api" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/createApi [post] func CreateApi(c *gin.Context) { var api sysModel.SysApi @@ -42,7 +42,7 @@ func CreateApi(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body sysModel.SysApi true "删除api" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/deleteApi [post] func DeleteApi(c *gin.Context) { var a sysModel.SysApi @@ -68,7 +68,7 @@ type AuthAndPathIn struct { // @accept application/json // @Produce application/json // @Param data body modelInterface.PageInfo true "分页获取API列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/getApiList [post] func GetApiList(c *gin.Context) { // 此结构体仅本方法使用 @@ -98,7 +98,7 @@ func GetApiList(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body modelInterface.PageInfo true "分页获取用户列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/getApiById [post] func GetApiById(c *gin.Context) { var idInfo GetById @@ -120,7 +120,7 @@ func GetApiById(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body api.CreateApiParams true "创建api" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/updataApi [post] func UpdataApi(c *gin.Context) { var api sysModel.SysApi @@ -138,7 +138,7 @@ func UpdataApi(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/getAllApis [post] func GetAllApis(c *gin.Context) { err, apis := new(sysModel.SysApi).GetAllApis() diff --git a/QMPlusServer/controller/api/sys_authority.go b/QMPlusServer/controller/api/sys_authority.go index 69b29235..7cf52776 100644 --- a/QMPlusServer/controller/api/sys_authority.go +++ b/QMPlusServer/controller/api/sys_authority.go @@ -9,7 +9,7 @@ import ( ) type CreateAuthorityPatams struct { - AuthorityId string `json:"authorityId"` + AuthorityId string `json:"authorityId"` AuthorityName string `json:"authorityName"` } @@ -19,7 +19,7 @@ type CreateAuthorityPatams struct { // @accept application/json // @Produce application/json // @Param data body api.CreateAuthorityPatams true "创建角色" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /authority/createAuthority [post] func CreateAuthority(c *gin.Context) { var auth sysModel.SysAuthority @@ -46,7 +46,7 @@ type DeleteAuthorityPatams struct { // @accept application/json // @Produce application/json // @Param data body api.DeleteAuthorityPatams true "删除角色" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /authority/deleteAuthority [post] func DeleteAuthority(c *gin.Context) { var a sysModel.SysAuthority @@ -66,9 +66,9 @@ func DeleteAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body modelInterface.PageInfo true "分页获取用户列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /authority/getAuthorityList [post] -func GetAuthorityList(c *gin.Context){ +func GetAuthorityList(c *gin.Context) { var pageInfo modelInterface.PageInfo _ = c.BindJSON(&pageInfo) err, list, total := new(sysModel.SysAuthority).GetInfoList(pageInfo) @@ -76,7 +76,7 @@ func GetAuthorityList(c *gin.Context){ servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{}) } else { servers.ReportFormat(c, true, "获取数据成功", gin.H{ - "list": list, + "list": list, "total": total, "page": pageInfo.Page, "pageSize": pageInfo.PageSize, @@ -84,8 +84,6 @@ func GetAuthorityList(c *gin.Context){ } } - type GetAuthorityId struct { AuthorityId string `json:"authorityId"` } - diff --git a/QMPlusServer/controller/api/sys_casbin.go b/QMPlusServer/controller/api/sys_casbin.go index 2a45e77f..299c2b19 100644 --- a/QMPlusServer/controller/api/sys_casbin.go +++ b/QMPlusServer/controller/api/sys_casbin.go @@ -7,10 +7,9 @@ import ( "main/model/sysModel" ) - type CasbinInReceive struct { - AuthorityId string `json:"authorityId"` - Paths []string `json:paths` + AuthorityId string `json:"authorityId"` + Paths []string `json:paths` } // @Tags casbin @@ -19,12 +18,12 @@ type CasbinInReceive struct { // @accept application/json // @Produce application/json // @Param data body api.CreateAuthorityPatams true "更改角色api权限" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/casbinPUpdata [post] -func CasbinPUpdata(c *gin.Context){ +func CasbinPUpdata(c *gin.Context) { var cmr CasbinInReceive _ = c.ShouldBind(&cmr) - err := new(sysModel.CasbinModel).CasbinPUpdata(cmr.AuthorityId,cmr.Paths) + err := new(sysModel.CasbinModel).CasbinPUpdata(cmr.AuthorityId, cmr.Paths) if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("添加规则失败,%v", err), gin.H{}) } else { @@ -38,11 +37,11 @@ func CasbinPUpdata(c *gin.Context){ // @accept application/json // @Produce application/json // @Param data body api.CreateAuthorityPatams true "获取权限列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/getPolicyPathByAuthorityId [post] -func GetPolicyPathByAuthorityId(c *gin.Context){ +func GetPolicyPathByAuthorityId(c *gin.Context) { var cmr CasbinInReceive _ = c.ShouldBind(&cmr) paths := new(sysModel.CasbinModel).GetPolicyPathByAuthorityId(cmr.AuthorityId) - servers.ReportFormat(c, true, "获取规则成功", gin.H{"paths":paths}) + servers.ReportFormat(c, true, "获取规则成功", gin.H{"paths": paths}) } diff --git a/QMPlusServer/controller/api/sys_menu.go b/QMPlusServer/controller/api/sys_menu.go index 695bf3a9..c2dde79a 100644 --- a/QMPlusServer/controller/api/sys_menu.go +++ b/QMPlusServer/controller/api/sys_menu.go @@ -5,8 +5,8 @@ import ( "github.com/gin-gonic/gin" "main/controller/servers" "main/middleware" - "main/model/sysModel" "main/model/modelInterface" + "main/model/sysModel" ) // @Tags authorityAndMenu @@ -14,7 +14,7 @@ import ( // @Security ApiKeyAuth // @Produce application/json // @Param data body api.RegistAndLoginStuct true "可以什么都不填" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"返回成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /menu/getMenu [post] func GetMenu(c *gin.Context) { claims, _ := c.Get("claims") @@ -33,7 +33,7 @@ func GetMenu(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body modelInterface.PageInfo true "分页获取基础menu列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/getMenuList [post] func GetMenuList(c *gin.Context) { var pageInfo modelInterface.PageInfo @@ -57,7 +57,7 @@ func GetMenuList(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body sysModel.SysBaseMenu true "新增菜单" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/addBaseMenu [post] func AddBaseMenu(c *gin.Context) { var addMenu sysModel.SysBaseMenu @@ -75,7 +75,7 @@ func AddBaseMenu(c *gin.Context) { // @Security ApiKeyAuth // @Produce application/json // @Param data body api.RegistAndLoginStuct true "可以什么都不填" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"返回成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /menu/getBaseMenuTree [post] func GetBaseMenuTree(c *gin.Context) { err, menus := new(sysModel.SysBaseMenu).GetBaseMenuTree() @@ -97,7 +97,7 @@ type AddMenuAuthorityInfo struct { // @accept application/json // @Produce application/json // @Param data body api.AddMenuAuthorityInfo true "增加menu和角色关联关系" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/addMenuAuthority [post] func AddMenuAuthority(c *gin.Context) { var addMenuAuthorityInfo AddMenuAuthorityInfo @@ -120,7 +120,7 @@ type AuthorityIdInfo struct { // @accept application/json // @Produce application/json // @Param data body api.AuthorityIdInfo true "增加menu和角色关联关系" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/addMenuAuthority [post] func GetMenuAuthority(c *gin.Context) { var authorityIdInfo AuthorityIdInfo @@ -143,7 +143,7 @@ type IdInfo struct { // @accept application/json // @Produce application/json // @Param data body api.IdInfo true "删除菜单" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/deleteBaseMenu [post] func DeleteBaseMenu(c *gin.Context) { var idInfo IdInfo @@ -162,7 +162,7 @@ func DeleteBaseMenu(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body sysModel.SysBaseMenu true "更新菜单" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/updataBaseMen [post] func UpdataBaseMenu(c *gin.Context) { var menu sysModel.SysBaseMenu @@ -185,7 +185,7 @@ type GetById struct { // @accept application/json // @Produce application/json // @Param data body api.GetById true "根据id获取菜单" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/getBaseMenuById [post] func GetBaseMenuById(c *gin.Context) { var idInfo GetById diff --git a/QMPlusServer/controller/api/sys_user.go b/QMPlusServer/controller/api/sys_user.go index 38f37f1d..752f6162 100644 --- a/QMPlusServer/controller/api/sys_user.go +++ b/QMPlusServer/controller/api/sys_user.go @@ -7,8 +7,8 @@ import ( uuid "github.com/satori/go.uuid" "main/controller/servers" "main/middleware" - "main/model/sysModel" "main/model/modelInterface" + "main/model/sysModel" "mime/multipart" "time" ) @@ -27,7 +27,7 @@ type RegistAndLoginStuct struct { // @Summary 用户注册账号 // @Produce application/json // @Param data body api.RegistAndLoginStuct true "用户注册接口" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"注册成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}" // @Router /base/regist [post] func Regist(c *gin.Context) { var R RegistAndLoginStuct @@ -50,7 +50,7 @@ func Regist(c *gin.Context) { // @Summary 用户登录 // @Produce application/json // @Param data body api.RegistAndLoginStuct true "用户登录接口" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"登陆成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}" // @Router /base/login [post] func Login(c *gin.Context) { var L RegistAndLoginStuct @@ -98,7 +98,7 @@ type ChangePasswordStutrc struct { // @Security ApiKeyAuth // @Produce application/json // @Param data body api.ChangePasswordStutrc true "用户修改密码" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"修改成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" // @Router /user/changePassword [post] func ChangePassword(c *gin.Context) { var params ChangePasswordStutrc @@ -122,7 +122,7 @@ type UserHeaderImg struct { // @Produce application/json // @Param headerImg formData file true "用户上传头像" // @Param username formData string true "用户上传头像" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"上传成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}" // @Router /user/uploadHeaderImg [post] func UploadHeaderImg(c *gin.Context) { claims, _ := c.Get("claims") @@ -157,7 +157,7 @@ func UploadHeaderImg(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body modelInterface.PageInfo true "分页获取用户列表" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /user/getUserList [post] func GetUserList(c *gin.Context) { var pageInfo modelInterface.PageInfo @@ -186,7 +186,7 @@ type SetUserAuth struct { // @accept application/json // @Produce application/json // @Param data body api.SetUserAuth true "设置用户权限" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"修改成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" // @Router /user/setUserAuthority [post] func SetUserAuthority(c *gin.Context) { var sua SetUserAuth diff --git a/QMPlusServer/controller/api/sys_workFlow.go b/QMPlusServer/controller/api/sys_workFlow.go index aa1f881a..0c565375 100644 --- a/QMPlusServer/controller/api/sys_workFlow.go +++ b/QMPlusServer/controller/api/sys_workFlow.go @@ -11,7 +11,7 @@ import ( // @Summary 注册工作流 // @Produce application/json // @Param data body sysModel.SysWorkflow true "注册工作流接口" -// @Success 200 {string} json "{"success":true,"data":{},"msg":"注册成功"}" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}" // @Router /workflow/createWorkFlow [post] func CreateWorkFlow(c *gin.Context) { var wk sysModel.SysWorkflow diff --git a/QMPlusServer/docs/docs.go b/QMPlusServer/docs/docs.go index 8ce1146a..5099a259 100644 --- a/QMPlusServer/docs/docs.go +++ b/QMPlusServer/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2019-12-13 11:22:41.4366202 +0800 CST m=+0.062830801 +// 2019-12-13 14:26:18.8216929 +0800 CST m=+0.080748501 package docs diff --git a/QMPlusServer/static/dbconfig/config.json b/QMPlusServer/static/dbconfig/config.json index b1ae2d09..e0d9bc1a 100644 --- a/QMPlusServer/static/dbconfig/config.json +++ b/QMPlusServer/static/dbconfig/config.json @@ -3,7 +3,7 @@ "username": "root", "password": "Aa@6447985", "path": "127.0.0.1:3306", - "dbname": "qmplus", + "dbname": "yx", "config": "charset=utf8&parseTime=True&loc=Local" } } \ No newline at end of file -- GitLab