From b86e98e52b1e9e6f028935eba574b26d7e73f192 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Mon, 10 Jan 2022 11:20:29 +0800 Subject: [PATCH] style:swagger optimize --- server/api/v1/autocode/auto_code_example.go | 10 ++++----- .../api/v1/example/exa_breakpoint_continue.go | 11 +++++----- server/api/v1/example/exa_customer.go | 10 ++++----- server/api/v1/example/exa_excel.go | 4 ++-- .../v1/example/exa_file_upload_download.go | 6 ++--- server/api/v1/system/sys_api.go | 17 +++++++------- server/api/v1/system/sys_authority.go | 12 +++++----- server/api/v1/system/sys_auto_code.go | 8 +++---- server/api/v1/system/sys_auto_code_history.go | 8 +++---- server/api/v1/system/sys_captcha.go | 2 +- server/api/v1/system/sys_casbin.go | 4 ++-- server/api/v1/system/sys_dictionary.go | 10 ++++----- server/api/v1/system/sys_dictionary_detail.go | 10 ++++----- server/api/v1/system/sys_initdb.go | 4 ++-- server/api/v1/system/sys_jwt_blacklist.go | 2 +- server/api/v1/system/sys_menu.go | 18 +++++++-------- server/api/v1/system/sys_operation_record.go | 10 ++++----- server/api/v1/system/sys_system.go | 8 +++---- server/api/v1/system/sys_user.go | 22 +++++++++---------- server/model/common/response/common.go | 8 +++---- .../response/exa_breakpoint_continue.go | 4 ++-- server/model/example/response/exa_customer.go | 2 +- .../response/exa_file_upload_download.go | 2 +- server/model/system/response/sys_api.go | 4 ++-- server/model/system/response/sys_authority.go | 6 ++--- server/model/system/response/sys_captcha.go | 6 ++--- server/model/system/response/sys_casbin.go | 2 +- server/model/system/response/sys_menu.go | 6 ++--- server/model/system/response/sys_system.go | 2 +- server/model/system/response/sys_user.go | 8 +++---- 30 files changed, 114 insertions(+), 112 deletions(-) diff --git a/server/api/v1/autocode/auto_code_example.go b/server/api/v1/autocode/auto_code_example.go index 8d3495996..a0f418eb1 100644 --- a/server/api/v1/autocode/auto_code_example.go +++ b/server/api/v1/autocode/auto_code_example.go @@ -21,7 +21,7 @@ var autoCodeExampleService = service.ServiceGroupApp.AutoCodeServiceGroup.AutoCo // @accept application/json // @Produce application/json // @Param data body autocode.AutoCodeExample true "AutoCodeExample模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Success 200 {object} response.Response{msg="创建成功"} "创建AutoCodeExample" // @Router /autoCodeExample/createAutoCodeExample [post] func (autoCodeExampleApi *AutoCodeExampleApi) CreateAutoCodeExample(c *gin.Context) { var autoCodeExample autocode.AutoCodeExample @@ -40,7 +40,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) CreateAutoCodeExample(c *gin.Conte // @accept application/json // @Produce application/json // @Param data body autocode.AutoCodeExample true "AutoCodeExample模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除AutoCodeExample" // @Router /autoCodeExample/deleteAutoCodeExample [delete] func (autoCodeExampleApi *AutoCodeExampleApi) DeleteAutoCodeExample(c *gin.Context) { var autoCodeExample autocode.AutoCodeExample @@ -59,7 +59,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) DeleteAutoCodeExample(c *gin.Conte // @accept application/json // @Produce application/json // @Param data body autocode.AutoCodeExample true "更新AutoCodeExample" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Success 200 {object} response.Response{msg="更新成功"} "更新AutoCodeExample" // @Router /autoCodeExample/updateAutoCodeExample [put] func (autoCodeExampleApi *AutoCodeExampleApi) UpdateAutoCodeExample(c *gin.Context) { var autoCodeExample autocode.AutoCodeExample @@ -78,7 +78,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) UpdateAutoCodeExample(c *gin.Conte // @accept application/json // @Produce application/json // @Param data query autocode.AutoCodeExample true "用id查询AutoCodeExample" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="查询成功"} "用id查询AutoCodeExample" // @Router /autoCodeExample/findAutoCodeExample [get] func (autoCodeExampleApi *AutoCodeExampleApi) FindAutoCodeExample(c *gin.Context) { var autoCodeExample autocode.AutoCodeExample @@ -101,7 +101,7 @@ func (autoCodeExampleApi *AutoCodeExampleApi) FindAutoCodeExample(c *gin.Context // @accept application/json // @Produce application/json // @Param data query autocodeReq.AutoCodeExampleSearch true "页码, 每页大小, 搜索条件" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取AutoCodeExample列表,返回包括列表,总数,页码,每页数量" // @Router /autoCodeExample/getAutoCodeExampleList [get] func (autoCodeExampleApi *AutoCodeExampleApi) GetAutoCodeExampleList(c *gin.Context) { var pageInfo autocodeReq.AutoCodeExampleSearch diff --git a/server/api/v1/example/exa_breakpoint_continue.go b/server/api/v1/example/exa_breakpoint_continue.go index 9dbb2f0e1..c34359ac2 100644 --- a/server/api/v1/example/exa_breakpoint_continue.go +++ b/server/api/v1/example/exa_breakpoint_continue.go @@ -2,11 +2,12 @@ package example import ( "fmt" - "github.com/flipped-aurora/gin-vue-admin/server/model/example" "io/ioutil" "mime/multipart" "strconv" + "github.com/flipped-aurora/gin-vue-admin/server/model/example" + "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" exampleRes "github.com/flipped-aurora/gin-vue-admin/server/model/example/response" @@ -21,7 +22,7 @@ import ( // @accept multipart/form-data // @Produce application/json // @Param file formData file true "an example for breakpoint resume, 断点续传示例" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"切片创建成功"}" +// @Success 200 {object} response.Response{msg="切片创建成功"} "断点续传到服务器" // @Router /fileUploadAndDownload/breakpointContinue [post] func (u *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) { fileMd5 := c.Request.FormValue("fileMd5") @@ -80,7 +81,7 @@ func (u *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) { // @accept multipart/form-data // @Produce application/json // @Param file formData file true "Find the file, 查找文件" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}" +// @Success 200 {object} response.Response{data=exampleRes.FileResponse,msg="查找成功"} "查找文件,返回包括文件详情" // @Router /fileUploadAndDownload/findFile [post] func (u *FileUploadAndDownloadApi) FindFile(c *gin.Context) { fileMd5 := c.Query("fileMd5") @@ -101,7 +102,7 @@ func (u *FileUploadAndDownloadApi) FindFile(c *gin.Context) { // @accept multipart/form-data // @Produce application/json // @Param file formData file true "上传文件完成" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"file uploaded, 文件创建成功"}" +// @Success 200 {object} response.Response{data=exampleRes.FilePathResponse,msg="文件创建成功"} "创建文件,返回包括文件路径" // @Router /fileUploadAndDownload/findFile [post] func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) { fileMd5 := c.Query("fileMd5") @@ -121,7 +122,7 @@ func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) { // @accept multipart/form-data // @Produce application/json // @Param file formData file true "删除缓存切片" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"缓存切片删除成功"}" +// @Success 200 {object} response.Response{msg="缓存切片删除成功"} "删除切片" // @Router /fileUploadAndDownload/removeChunk [post] func (u *FileUploadAndDownloadApi) RemoveChunk(c *gin.Context) { var file example.ExaFile diff --git a/server/api/v1/example/exa_customer.go b/server/api/v1/example/exa_customer.go index 4a3aecc26..2fd1ccf73 100644 --- a/server/api/v1/example/exa_customer.go +++ b/server/api/v1/example/exa_customer.go @@ -19,7 +19,7 @@ type CustomerApi struct{} // @accept application/json // @Produce application/json // @Param data body example.ExaCustomer true "客户用户名, 客户手机号码" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Success 200 {object} response.Response{msg="创建成功"} "创建客户" // @Router /customer/customer [post] func (e *CustomerApi) CreateExaCustomer(c *gin.Context) { var customer example.ExaCustomer @@ -44,7 +44,7 @@ func (e *CustomerApi) CreateExaCustomer(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body example.ExaCustomer true "客户ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除客户" // @Router /customer/customer [delete] func (e *CustomerApi) DeleteExaCustomer(c *gin.Context) { var customer example.ExaCustomer @@ -67,7 +67,7 @@ func (e *CustomerApi) DeleteExaCustomer(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body example.ExaCustomer true "客户ID, 客户信息" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Success 200 {object} response.Response{msg="更新成功"} "更新客户信息" // @Router /customer/customer [put] func (e *CustomerApi) UpdateExaCustomer(c *gin.Context) { var customer example.ExaCustomer @@ -94,7 +94,7 @@ func (e *CustomerApi) UpdateExaCustomer(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query example.ExaCustomer true "客户ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=exampleRes.ExaCustomerResponse,msg="获取成功"} "获取单一客户信息,返回包括客户详情" // @Router /customer/customer [get] func (e *CustomerApi) GetExaCustomer(c *gin.Context) { var customer example.ExaCustomer @@ -118,7 +118,7 @@ func (e *CustomerApi) GetExaCustomer(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query request.PageInfo true "页码, 每页大小" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取权限客户列表,返回包括列表,总数,页码,每页数量" // @Router /customer/customerList [get] func (e *CustomerApi) GetExaCustomerList(c *gin.Context) { var pageInfo request.PageInfo diff --git a/server/api/v1/example/exa_excel.go b/server/api/v1/example/exa_excel.go index 22a13645d..73fc190b7 100644 --- a/server/api/v1/example/exa_excel.go +++ b/server/api/v1/example/exa_excel.go @@ -44,7 +44,7 @@ func (e *ExcelApi) ExportExcel(c *gin.Context) { // @accept multipart/form-data // @Produce application/json // @Param file formData file true "导入Excel文件" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"导入成功"}" +// @Success 200 {object} response.Response{msg="导入成功"} "导入Excel文件" // @Router /excel/importExcel [post] func (e *ExcelApi) ImportExcel(c *gin.Context) { _, header, err := c.Request.FormFile("file") @@ -61,7 +61,7 @@ func (e *ExcelApi) ImportExcel(c *gin.Context) { // @Summary 加载Excel数据 // @Security ApiKeyAuth // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"加载数据成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="加载数据成功"} "加载Excel数据,返回包括列表,总数,页码,每页数量" // @Router /excel/loadExcel [get] func (e *ExcelApi) LoadExcel(c *gin.Context) { menus, err := excelService.ParseExcel2InfoList() diff --git a/server/api/v1/example/exa_file_upload_download.go b/server/api/v1/example/exa_file_upload_download.go index 6d33b4a06..dd1550150 100644 --- a/server/api/v1/example/exa_file_upload_download.go +++ b/server/api/v1/example/exa_file_upload_download.go @@ -18,7 +18,7 @@ type FileUploadAndDownloadApi struct{} // @accept multipart/form-data // @Produce application/json // @Param file formData file true "上传文件示例" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}" +// @Success 200 {object} response.Response{data=exampleRes.ExaFileResponse,msg="上传成功"} "上传文件示例,返回包括文件详情" // @Router /fileUploadAndDownload/upload [post] func (u *FileUploadAndDownloadApi) UploadFile(c *gin.Context) { var file example.ExaFileUploadAndDownload @@ -43,7 +43,7 @@ func (u *FileUploadAndDownloadApi) UploadFile(c *gin.Context) { // @Security ApiKeyAuth // @Produce application/json // @Param data body example.ExaFileUploadAndDownload true "传入文件里面id即可" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除文件" // @Router /fileUploadAndDownload/deleteFile [post] func (u *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) { var file example.ExaFileUploadAndDownload @@ -62,7 +62,7 @@ func (u *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页文件列表,返回包括列表,总数,页码,每页数量" // @Router /fileUploadAndDownload/getFileList [post] func (u *FileUploadAndDownloadApi) GetFileList(c *gin.Context) { var pageInfo request.PageInfo diff --git a/server/api/v1/system/sys_api.go b/server/api/v1/system/sys_api.go index cb1f6772a..4bc67c30e 100644 --- a/server/api/v1/system/sys_api.go +++ b/server/api/v1/system/sys_api.go @@ -21,7 +21,7 @@ type SystemApiApi struct{} // @accept application/json // @Produce application/json // @Param data body system.SysApi true "api路径, api中文描述, api组, 方法" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Success 200 {object} response.Response{msg="创建成功"} "创建基础api" // @Router /api/createApi [post] func (s *SystemApiApi) CreateApi(c *gin.Context) { var api system.SysApi @@ -44,7 +44,7 @@ func (s *SystemApiApi) CreateApi(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysApi true "ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除api" // @Router /api/deleteApi [post] func (s *SystemApiApi) DeleteApi(c *gin.Context) { var api system.SysApi @@ -67,7 +67,7 @@ func (s *SystemApiApi) DeleteApi(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body systemReq.SearchApiParams true "分页获取API列表" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取API列表,返回包括列表,总数,页码,每页数量" // @Router /api/getApiList [post] func (s *SystemApiApi) GetApiList(c *gin.Context) { var pageInfo systemReq.SearchApiParams @@ -89,13 +89,14 @@ func (s *SystemApiApi) GetApiList(c *gin.Context) { } } +// todo // @Tags SysApi // @Summary 根据id获取api // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body request.GetById true "根据id获取api" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysAPIResponse} "根据id获取api,返回包括api详情" // @Router /api/getApiById [post] func (s *SystemApiApi) GetApiById(c *gin.Context) { var idInfo request.GetById @@ -114,12 +115,12 @@ func (s *SystemApiApi) GetApiById(c *gin.Context) { } // @Tags SysApi -// @Summary 创建基础api +// @Summary 修改基础api // @Security ApiKeyAuth // @accept application/json // @Produce application/json // @Param data body system.SysApi true "api路径, api中文描述, api组, 方法" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Success 200 {object} response.Response{msg="修改成功"} "修改基础api" // @Router /api/updateApi [post] func (s *SystemApiApi) UpdateApi(c *gin.Context) { var api system.SysApi @@ -141,7 +142,7 @@ func (s *SystemApiApi) UpdateApi(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysAPIListResponse,msg="获取成功"} "获取所有的Api 不分页,返回包括api列表" // @Router /api/getAllApis [post] func (s *SystemApiApi) GetAllApis(c *gin.Context) { if err, apis := apiService.GetAllApis(); err != nil { @@ -158,7 +159,7 @@ func (s *SystemApiApi) GetAllApis(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.IdsReq true "ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除选中Api" // @Router /api/deleteApisByIds [delete] func (s *SystemApiApi) DeleteApisByIds(c *gin.Context) { var ids request.IdsReq diff --git a/server/api/v1/system/sys_authority.go b/server/api/v1/system/sys_authority.go index 32e669eb5..c7181bf93 100644 --- a/server/api/v1/system/sys_authority.go +++ b/server/api/v1/system/sys_authority.go @@ -21,7 +21,7 @@ type AuthorityApi struct{} // @accept application/json // @Produce application/json // @Param data body system.SysAuthority true "权限id, 权限名, 父角色id" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg="创建成功"} "创建角色,返回包括系统角色详情" // @Router /authority/createAuthority [post] func (a *AuthorityApi) CreateAuthority(c *gin.Context) { var authority system.SysAuthority @@ -46,7 +46,7 @@ func (a *AuthorityApi) CreateAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body response.SysAuthorityCopyResponse true "旧角色id, 新权限id, 新权限名, 新父角色id" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"拷贝成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg="拷贝成功"} "拷贝角色,返回包括系统角色详情" // @Router /authority/copyAuthority [post] func (a *AuthorityApi) CopyAuthority(c *gin.Context) { var copyInfo systemRes.SysAuthorityCopyResponse @@ -73,7 +73,7 @@ func (a *AuthorityApi) CopyAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysAuthority true "删除角色" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除角色" // @Router /authority/deleteAuthority [post] func (a *AuthorityApi) DeleteAuthority(c *gin.Context) { var authority system.SysAuthority @@ -96,7 +96,7 @@ func (a *AuthorityApi) DeleteAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysAuthority true "权限id, 权限名, 父角色id" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg="更新成功"} "更新角色信息,返回包括系统角色详情" // @Router /authority/updateAuthority [post] func (a *AuthorityApi) UpdateAuthority(c *gin.Context) { var auth system.SysAuthority @@ -119,7 +119,7 @@ func (a *AuthorityApi) UpdateAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取角色列表,返回包括列表,总数,页码,每页数量" // @Router /authority/getAuthorityList [post] func (a *AuthorityApi) GetAuthorityList(c *gin.Context) { var pageInfo request.PageInfo @@ -147,7 +147,7 @@ func (a *AuthorityApi) GetAuthorityList(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysAuthority true "设置角色资源权限" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Success 200 {object} response.Response{msg="设置成功"} "设置角色资源权限" // @Router /authority/setDataAuthority [post] func (a *AuthorityApi) SetDataAuthority(c *gin.Context) { var auth system.SysAuthority diff --git a/server/api/v1/system/sys_auto_code.go b/server/api/v1/system/sys_auto_code.go index 7b24e9267..ea56c13b1 100644 --- a/server/api/v1/system/sys_auto_code.go +++ b/server/api/v1/system/sys_auto_code.go @@ -24,7 +24,7 @@ type AutoCodeApi struct{} // @accept application/json // @Produce application/json // @Param data body system.AutoCodeStruct true "预览创建代码" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="预览成功"} "预览创建后的代码" // @Router /autoCode/preview [post] func (autoApi *AutoCodeApi) PreviewTemp(c *gin.Context) { var a system.AutoCodeStruct @@ -94,7 +94,7 @@ func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="获取成功"} "获取当前所有数据库" // @Router /autoCode/getDatabase [get] func (autoApi *AutoCodeApi) GetDB(c *gin.Context) { dbs, err := autoCodeService.Database().GetDB() @@ -111,7 +111,7 @@ func (autoApi *AutoCodeApi) GetDB(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="获取成功"} "获取当前数据库所有表" // @Router /autoCode/getTables [get] func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) @@ -130,7 +130,7 @@ func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="获取成功"} "获取当前表所有字段" // @Router /autoCode/getColumn [get] func (autoApi *AutoCodeApi) GetColumn(c *gin.Context) { dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) diff --git a/server/api/v1/system/sys_auto_code_history.go b/server/api/v1/system/sys_auto_code_history.go index 7254b96b3..3ab1eb818 100644 --- a/server/api/v1/system/sys_auto_code_history.go +++ b/server/api/v1/system/sys_auto_code_history.go @@ -18,7 +18,7 @@ type AutoCodeHistoryApi struct{} // @accept application/json // @Produce application/json // @Param data body request.GetById true "请求参数" -// @Success 200 {object} response.Response{} "获取成功!" +// @Success 200 {object} response.Response{data=gin.H,msg="获取成功"} "获取meta信息" // @Router /autoCode/getMeta [post] func (a *AutoCodeHistoryApi) First(c *gin.Context) { var info request.GetById @@ -38,7 +38,7 @@ func (a *AutoCodeHistoryApi) First(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.GetById true "请求参数" -// @Success 200 {object} response.Response{} "删除成功!" +// @Success 200 {object} response.Response{msg="删除成功"} "删除回滚记录" // @Router /autoCode/delSysHistory [post] func (a *AutoCodeHistoryApi) Delete(c *gin.Context) { var info request.GetById @@ -59,7 +59,7 @@ func (a *AutoCodeHistoryApi) Delete(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.GetById true "请求参数" -// @Success 200 {object} response.Response{} "回滚成功!" +// @Success 200 {object} response.Response{msg="回滚成功"} "回滚自动生成代码" // @Router /autoCode/rollback [post] func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) { var info request.GetById @@ -78,7 +78,7 @@ func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body systemReq.SysAutoHistory true "请求参数" -// @Success 200 {object} response.Response{} "获取成功!" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "查询回滚记录,返回包括列表,总数,页码,每页数量" // @Router /autoCode/getSysHistory [post] func (a *AutoCodeHistoryApi) GetList(c *gin.Context) { var search systemReq.SysAutoHistory diff --git a/server/api/v1/system/sys_captcha.go b/server/api/v1/system/sys_captcha.go index c1b0227c7..e1e8e9269 100644 --- a/server/api/v1/system/sys_captcha.go +++ b/server/api/v1/system/sys_captcha.go @@ -21,7 +21,7 @@ type BaseApi struct{} // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {object} response.Response{data=systemRes.SysCaptchaResponse} "生成一个随机验证码,返回包括随机生成id,base64 图像字符串,验证码长度" +// @Success 200 {object} response.Response{data=systemRes.SysCaptchaResponse,msg="验证码获取成功"} "生成验证码,返回包括随机数id,base64,验证码长度" // @Router /base/captcha [post] func (b *BaseApi) Captcha(c *gin.Context) { // 字符,公式,验证码配置 diff --git a/server/api/v1/system/sys_casbin.go b/server/api/v1/system/sys_casbin.go index eef09f641..0232bf96c 100644 --- a/server/api/v1/system/sys_casbin.go +++ b/server/api/v1/system/sys_casbin.go @@ -18,7 +18,7 @@ type CasbinApi struct{} // @accept application/json // @Produce application/json // @Param data body request.CasbinInReceive true "权限id, 权限模型列表" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Success 200 {object} response.Response{msg="更新成功"} "更新角色api权限" // @Router /casbin/UpdateCasbin [post] func (cas *CasbinApi) UpdateCasbin(c *gin.Context) { var cmr request.CasbinInReceive @@ -41,7 +41,7 @@ func (cas *CasbinApi) UpdateCasbin(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.CasbinInReceive true "权限id, 权限模型列表" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.PolicyPathResponse,msg="获取成功"} "获取权限列表,返回包括casbin详情列表" // @Router /casbin/getPolicyPathByAuthorityId [post] func (cas *CasbinApi) GetPolicyPathByAuthorityId(c *gin.Context) { var casbin request.CasbinInReceive diff --git a/server/api/v1/system/sys_dictionary.go b/server/api/v1/system/sys_dictionary.go index d3c560e17..80e810668 100644 --- a/server/api/v1/system/sys_dictionary.go +++ b/server/api/v1/system/sys_dictionary.go @@ -18,7 +18,7 @@ type DictionaryApi struct{} // @accept application/json // @Produce application/json // @Param data body system.SysDictionary true "SysDictionary模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Success 200 {object} response.Response{msg="创建成功"} "创建SysDictionary" // @Router /sysDictionary/createSysDictionary [post] func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) { var dictionary system.SysDictionary @@ -37,7 +37,7 @@ func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysDictionary true "SysDictionary模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除SysDictionary" // @Router /sysDictionary/deleteSysDictionary [delete] func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) { var dictionary system.SysDictionary @@ -56,7 +56,7 @@ func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysDictionary true "SysDictionary模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Success 200 {object} response.Response{msg="更新成功"} "更新SysDictionary" // @Router /sysDictionary/updateSysDictionary [put] func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) { var dictionary system.SysDictionary @@ -75,7 +75,7 @@ func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query system.SysDictionary true "ID或字典英名" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="查询成功"} "用id查询SysDictionary" // @Router /sysDictionary/findSysDictionary [get] func (s *DictionaryApi) FindSysDictionary(c *gin.Context) { var dictionary system.SysDictionary @@ -94,7 +94,7 @@ func (s *DictionaryApi) FindSysDictionary(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query request.SysDictionarySearch true "页码, 每页大小, 搜索条件" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取SysDictionary列表,返回包括列表,总数,页码,每页数量" // @Router /sysDictionary/getSysDictionaryList [get] func (s *DictionaryApi) GetSysDictionaryList(c *gin.Context) { var pageInfo request.SysDictionarySearch diff --git a/server/api/v1/system/sys_dictionary_detail.go b/server/api/v1/system/sys_dictionary_detail.go index 5c06246c5..566f5448c 100644 --- a/server/api/v1/system/sys_dictionary_detail.go +++ b/server/api/v1/system/sys_dictionary_detail.go @@ -18,7 +18,7 @@ type DictionaryDetailApi struct{} // @accept application/json // @Produce application/json // @Param data body system.SysDictionaryDetail true "SysDictionaryDetail模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Success 200 {object} response.Response{msg="创建成功"} "创建SysDictionaryDetail" // @Router /sysDictionaryDetail/createSysDictionaryDetail [post] func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail @@ -37,7 +37,7 @@ func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysDictionaryDetail true "SysDictionaryDetail模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除SysDictionaryDetail" // @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete] func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail @@ -56,7 +56,7 @@ func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysDictionaryDetail true "更新SysDictionaryDetail" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Success 200 {object} response.Response{msg="更新成功"} "更新SysDictionaryDetail" // @Router /sysDictionaryDetail/updateSysDictionaryDetail [put] func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail @@ -75,7 +75,7 @@ func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query system.SysDictionaryDetail true "用id查询SysDictionaryDetail" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="查询成功"} "用id查询SysDictionaryDetail" // @Router /sysDictionaryDetail/findSysDictionaryDetail [get] func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail @@ -98,7 +98,7 @@ func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query request.SysDictionaryDetailSearch true "页码, 每页大小, 搜索条件" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取SysDictionaryDetail列表,返回包括列表,总数,页码,每页数量" // @Router /sysDictionaryDetail/getSysDictionaryDetailList [get] func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) { var pageInfo request.SysDictionaryDetailSearch diff --git a/server/api/v1/system/sys_initdb.go b/server/api/v1/system/sys_initdb.go index d3d66a530..3cca5237e 100644 --- a/server/api/v1/system/sys_initdb.go +++ b/server/api/v1/system/sys_initdb.go @@ -16,7 +16,7 @@ type DBApi struct{} // @Summary 初始化用户数据库 // @Produce application/json // @Param data body request.InitDB true "初始化数据库参数" -// @Success 200 {string} string "{"code":0,"data":{},"msg":"自动创建数据库成功"}" +// @Success 200 {object} response.Response{data="自动创建数据库成功"} "初始化用户数据库" // @Router /init/initdb [post] func (i *DBApi) InitDB(c *gin.Context) { if global.GVA_DB != nil { @@ -42,7 +42,7 @@ func (i *DBApi) InitDB(c *gin.Context) { // @Tags CheckDB // @Summary 初始化用户数据库 // @Produce application/json -// @Success 200 {string} string "{"code":0,"data":{},"msg":"探测完成"}" +// @Success 200 {object} response.Response{data=gin.H,msg=} "初始化用户数据库" // @Router /init/checkdb [post] func (i *DBApi) CheckDB(c *gin.Context) { var ( diff --git a/server/api/v1/system/sys_jwt_blacklist.go b/server/api/v1/system/sys_jwt_blacklist.go index 8d377f301..2fd215795 100644 --- a/server/api/v1/system/sys_jwt_blacklist.go +++ b/server/api/v1/system/sys_jwt_blacklist.go @@ -15,7 +15,7 @@ type JwtApi struct{} // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"拉黑成功"}" +// @Success 200 {object} response.Response{msg="jwt作废成功"} "jwt加入黑名单" // @Router /jwt/jsonInBlacklist [post] func (j *JwtApi) JsonInBlacklist(c *gin.Context) { token := c.Request.Header.Get("x-token") diff --git a/server/api/v1/system/sys_menu.go b/server/api/v1/system/sys_menu.go index dc125d628..6aa1484f0 100644 --- a/server/api/v1/system/sys_menu.go +++ b/server/api/v1/system/sys_menu.go @@ -20,7 +20,7 @@ type AuthorityMenuApi struct{} // @Security ApiKeyAuth // @Produce application/json // @Param data body request.Empty true "空" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysMenusResponse,msg="获取成功"} "获取用户动态路由,返回包括系统菜单详情列表" // @Router /menu/getMenu [post] func (a *AuthorityMenuApi) GetMenu(c *gin.Context) { if err, menus := menuService.GetMenuTree(utils.GetUserAuthorityId(c)); err != nil { @@ -39,7 +39,7 @@ func (a *AuthorityMenuApi) GetMenu(c *gin.Context) { // @Security ApiKeyAuth // @Produce application/json // @Param data body request.Empty true "空" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysBaseMenusResponse,msg="获取成功"} "获取用户动态路由,返回包括系统菜单列表" // @Router /menu/getBaseMenuTree [post] func (a *AuthorityMenuApi) GetBaseMenuTree(c *gin.Context) { if err, menus := menuService.GetBaseMenuTree(); err != nil { @@ -56,7 +56,7 @@ func (a *AuthorityMenuApi) GetBaseMenuTree(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body systemReq.AddMenuAuthorityInfo true "角色ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}" +// @Success 200 {object} response.Response{msg="添加成功"} "增加menu和角色关联关系" // @Router /menu/addMenuAuthority [post] func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) { var authorityMenu systemReq.AddMenuAuthorityInfo @@ -79,7 +79,7 @@ func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.GetAuthorityId true "角色ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="获取成功"} "获取指定角色menu" // @Router /menu/getMenuAuthority [post] func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) { var param request.GetAuthorityId @@ -102,7 +102,7 @@ func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}" +// @Success 200 {object} response.Response{msg="添加成功"} "新增菜单" // @Router /menu/addBaseMenu [post] func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) { var menu system.SysBaseMenu @@ -130,7 +130,7 @@ func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.GetById true "菜单id" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除菜单" // @Router /menu/deleteBaseMenu [post] func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) { var menu request.GetById @@ -153,7 +153,7 @@ func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Success 200 {object} response.Response{msg="更新成功"} "更新菜单" // @Router /menu/updateBaseMenu [post] func (a *AuthorityMenuApi) UpdateBaseMenu(c *gin.Context) { var menu system.SysBaseMenu @@ -180,7 +180,7 @@ func (a *AuthorityMenuApi) UpdateBaseMenu(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.GetById true "菜单id" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysBaseMenuResponse,msg="获取成功"} "根据id获取菜单,返回包括系统菜单列表" // @Router /menu/getBaseMenuById [post] func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) { var idInfo request.GetById @@ -203,7 +203,7 @@ func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取基础menu列表,返回包括列表,总数,页码,每页数量" // @Router /menu/getMenuList [post] func (a *AuthorityMenuApi) GetMenuList(c *gin.Context) { var pageInfo request.PageInfo diff --git a/server/api/v1/system/sys_operation_record.go b/server/api/v1/system/sys_operation_record.go index 89d574640..b2369cc9e 100644 --- a/server/api/v1/system/sys_operation_record.go +++ b/server/api/v1/system/sys_operation_record.go @@ -19,7 +19,7 @@ type OperationRecordApi struct{} // @accept application/json // @Produce application/json // @Param data body system.SysOperationRecord true "创建SysOperationRecord" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{msg="创建成功"} "创建SysOperationRecord" // @Router /sysOperationRecord/createSysOperationRecord [post] func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord @@ -38,7 +38,7 @@ func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysOperationRecord true "SysOperationRecord模型" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除SysOperationRecord" // @Router /sysOperationRecord/deleteSysOperationRecord [delete] func (s *OperationRecordApi) DeleteSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord @@ -57,7 +57,7 @@ func (s *OperationRecordApi) DeleteSysOperationRecord(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.IdsReq true "批量删除SysOperationRecord" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}" +// @Success 200 {object} response.Response{msg="批量删除成功"} "批量删除SysOperationRecord" // @Router /sysOperationRecord/deleteSysOperationRecordByIds [delete] func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) { var IDS request.IdsReq @@ -76,7 +76,7 @@ func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query system.SysOperationRecord true "Id" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="查询成功"} "用id查询SysOperationRecord" // @Router /sysOperationRecord/findSysOperationRecord [get] func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord @@ -99,7 +99,7 @@ func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data query request.SysOperationRecordSearch true "页码, 每页大小, 搜索条件" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取SysOperationRecord列表,返回包括列表,总数,页码,每页数量" // @Router /sysOperationRecord/getSysOperationRecordList [get] func (s *OperationRecordApi) GetSysOperationRecordList(c *gin.Context) { var pageInfo systemReq.SysOperationRecordSearch diff --git a/server/api/v1/system/sys_system.go b/server/api/v1/system/sys_system.go index 970bc46bf..460049ada 100644 --- a/server/api/v1/system/sys_system.go +++ b/server/api/v1/system/sys_system.go @@ -17,7 +17,7 @@ type SystemApi struct{} // @Summary 获取配置文件内容 // @Security ApiKeyAuth // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysConfigResponse,msg="获取成功"} "获取配置文件内容,返回包括系统配置" // @Router /system/getSystemConfig [post] func (s *SystemApi) GetSystemConfig(c *gin.Context) { if err, config := systemConfigService.GetSystemConfig(); err != nil { @@ -33,7 +33,7 @@ func (s *SystemApi) GetSystemConfig(c *gin.Context) { // @Security ApiKeyAuth // @Produce application/json // @Param data body system.System true "设置配置文件内容" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Success 200 {object} response.Response{data="设置成功"} "设置配置文件内容" // @Router /system/setSystemConfig [post] func (s *SystemApi) SetSystemConfig(c *gin.Context) { var sys system.System @@ -50,7 +50,7 @@ func (s *SystemApi) SetSystemConfig(c *gin.Context) { // @Summary 重启系统 // @Security ApiKeyAuth // @Produce application/json -// @Success 200 {string} string "{"code":0,"data":{},"msg":"重启系统成功"}" +// @Success 200 {object} response.Response{msg="重启系统成功"} "重启系统" // @Router /system/reloadSystem [post] func (s *SystemApi) ReloadSystem(c *gin.Context) { err := utils.Reload() @@ -66,7 +66,7 @@ func (s *SystemApi) ReloadSystem(c *gin.Context) { // @Summary 获取服务器信息 // @Security ApiKeyAuth // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="获取成功"} "获取服务器信息" // @Router /system/getServerInfo [post] func (s *SystemApi) GetServerInfo(c *gin.Context) { if server, err := systemConfigService.GetServerInfo(); err != nil { diff --git a/server/api/v1/system/sys_user.go b/server/api/v1/system/sys_user.go index cff70e87d..4c977fb53 100644 --- a/server/api/v1/system/sys_user.go +++ b/server/api/v1/system/sys_user.go @@ -20,7 +20,7 @@ import ( // @Summary 用户登录 // @Produce application/json // @Param data body systemReq.Login true "用户名, 密码, 验证码" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}" +// @Success 200 {object} response.Response{data=systemRes.LoginResponse,msg="登录成功"} ",返回包括用户信息,token,过期时间" // @Router /base/login [post] func (b *BaseApi) Login(c *gin.Context) { var l systemReq.Login @@ -104,7 +104,7 @@ func (b *BaseApi) tokenNext(c *gin.Context, user system.SysUser) { // @Summary 用户注册账号 // @Produce application/json // @Param data body systemReq.Register true "用户名, 昵称, 密码, 角色ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}" +// @Success 200 {object} response.Response{data=systemRes.SysUserResponse,msg="注册成功"} "用户注册账号,返回包括用户信息" // @Router /user/register [post] func (b *BaseApi) Register(c *gin.Context) { var r systemReq.Register @@ -134,7 +134,7 @@ func (b *BaseApi) Register(c *gin.Context) { // @Security ApiKeyAuth // @Produce application/json // @Param data body systemReq.ChangePasswordStruct true "用户名, 原密码, 新密码" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Success 200 {object} response.Response{msg="修改成功"} "用户修改密码" // @Router /user/changePassword [post] func (b *BaseApi) ChangePassword(c *gin.Context) { var user systemReq.ChangePasswordStruct @@ -158,7 +158,7 @@ func (b *BaseApi) ChangePassword(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=response.PageResult,msg="获取成功"} "分页获取用户列表,返回包括列表,总数,页码,每页数量" // @Router /user/getUserList [post] func (b *BaseApi) GetUserList(c *gin.Context) { var pageInfo request.PageInfo @@ -186,7 +186,7 @@ func (b *BaseApi) GetUserList(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body systemReq.SetUserAuth true "用户UUID, 角色ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Success 200 {object} response.Response{msg="修改成功"} "设置用户权限" // @Router /user/setUserAuthority [post] func (b *BaseApi) SetUserAuthority(c *gin.Context) { var sua systemReq.SetUserAuth @@ -222,7 +222,7 @@ func (b *BaseApi) SetUserAuthority(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body systemReq.SetUserAuthorities true "用户UUID, 角色ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Success 200 {object} response.Response{msg="修改成功"} "设置用户权限" // @Router /user/setUserAuthorities [post] func (b *BaseApi) SetUserAuthorities(c *gin.Context) { var sua systemReq.SetUserAuthorities @@ -241,7 +241,7 @@ func (b *BaseApi) SetUserAuthorities(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body request.GetById true "用户ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Success 200 {object} response.Response{msg="删除成功"} "删除用户" // @Router /user/deleteUser [delete] func (b *BaseApi) DeleteUser(c *gin.Context) { var reqId request.GetById @@ -269,7 +269,7 @@ func (b *BaseApi) DeleteUser(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysUser true "ID, 用户名, 昵称, 头像链接" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="设置成功"} "设置用户信息" // @Router /user/setUserInfo [put] func (b *BaseApi) SetUserInfo(c *gin.Context) { var user system.SysUser @@ -292,7 +292,7 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) { // @accept application/json // @Produce application/json // @Param data body system.SysUser true "ID, 用户名, 昵称, 头像链接" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="设置成功"} "设置用户信息" // @Router /user/SetSelfInfo [put] func (b *BaseApi) SetSelfInfo(c *gin.Context) { var user system.SysUser @@ -311,7 +311,7 @@ func (b *BaseApi) SetSelfInfo(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Success 200 {object} response.Response{data=gin.H,msg="获取成功"} "获取用户信息" // @Router /user/getUserInfo [get] func (b *BaseApi) GetUserInfo(c *gin.Context) { uuid := utils.GetUserUuid(c) @@ -328,7 +328,7 @@ func (b *BaseApi) GetUserInfo(c *gin.Context) { // @Security ApiKeyAuth // @Produce application/json // @Param data body system.SysUser true "ID" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Success 200 {object} response.Response{msg="重置成功"} "用户修改密码" // @Router /user/resetPassword [post] func (b *BaseApi) ResetPassword(c *gin.Context) { var user system.SysUser diff --git a/server/model/common/response/common.go b/server/model/common/response/common.go index 74610965b..b679bc9e9 100644 --- a/server/model/common/response/common.go +++ b/server/model/common/response/common.go @@ -1,8 +1,8 @@ package response type PageResult struct { - List interface{} `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List interface{} `json:"list" comment:"列表"` + Total int64 `json:"total" comment:"总数"` + Page int `json:"page" comment:"页码"` + PageSize int `json:"pageSize" comment:"每页数量"` } diff --git a/server/model/example/response/exa_breakpoint_continue.go b/server/model/example/response/exa_breakpoint_continue.go index 54aa3516b..8e0082e92 100644 --- a/server/model/example/response/exa_breakpoint_continue.go +++ b/server/model/example/response/exa_breakpoint_continue.go @@ -3,9 +3,9 @@ package response import "github.com/flipped-aurora/gin-vue-admin/server/model/example" type FilePathResponse struct { - FilePath string `json:"filePath"` + FilePath string `json:"filePath" comment:"文件路径"` } type FileResponse struct { - File example.ExaFile `json:"file"` + File example.ExaFile `json:"file" comment:"文件详情"` } diff --git a/server/model/example/response/exa_customer.go b/server/model/example/response/exa_customer.go index 7fd26f9d6..f126c0027 100644 --- a/server/model/example/response/exa_customer.go +++ b/server/model/example/response/exa_customer.go @@ -3,5 +3,5 @@ package response import "github.com/flipped-aurora/gin-vue-admin/server/model/example" type ExaCustomerResponse struct { - Customer example.ExaCustomer `json:"customer"` + Customer example.ExaCustomer `json:"customer" comment:"客户详情"` } diff --git a/server/model/example/response/exa_file_upload_download.go b/server/model/example/response/exa_file_upload_download.go index c1b7931a0..d133c17ee 100644 --- a/server/model/example/response/exa_file_upload_download.go +++ b/server/model/example/response/exa_file_upload_download.go @@ -3,5 +3,5 @@ package response import "github.com/flipped-aurora/gin-vue-admin/server/model/example" type ExaFileResponse struct { - File example.ExaFileUploadAndDownload `json:"file"` + File example.ExaFileUploadAndDownload `json:"file" comment:"文件详情"` } diff --git a/server/model/system/response/sys_api.go b/server/model/system/response/sys_api.go index 09dc72f8b..4c6207690 100644 --- a/server/model/system/response/sys_api.go +++ b/server/model/system/response/sys_api.go @@ -3,9 +3,9 @@ package response import "github.com/flipped-aurora/gin-vue-admin/server/model/system" type SysAPIResponse struct { - Api system.SysApi `json:"api"` + Api system.SysApi `json:"api" comment:"api详情"` } type SysAPIListResponse struct { - Apis []system.SysApi `json:"apis"` + Apis []system.SysApi `json:"apis" comment:"api列表"` } diff --git a/server/model/system/response/sys_authority.go b/server/model/system/response/sys_authority.go index 7eaaacaf9..c253a4837 100644 --- a/server/model/system/response/sys_authority.go +++ b/server/model/system/response/sys_authority.go @@ -3,10 +3,10 @@ package response import "github.com/flipped-aurora/gin-vue-admin/server/model/system" type SysAuthorityResponse struct { - Authority system.SysAuthority `json:"authority"` + Authority system.SysAuthority `json:"authority" comment:"系统角色详情"` } type SysAuthorityCopyResponse struct { - Authority system.SysAuthority `json:"authority"` - OldAuthorityId string `json:"oldAuthorityId"` // 旧角色ID + Authority system.SysAuthority `json:"authority" comment:"系统角色详情"` + OldAuthorityId string `json:"oldAuthorityId" comment:"旧角色ID"` // 旧角色ID } diff --git a/server/model/system/response/sys_captcha.go b/server/model/system/response/sys_captcha.go index 22c4dcca9..bcb5862b1 100644 --- a/server/model/system/response/sys_captcha.go +++ b/server/model/system/response/sys_captcha.go @@ -1,7 +1,7 @@ package response type SysCaptchaResponse struct { - CaptchaId string `json:"captchaId" example:"axxbbas"` // 随机数id - PicPath string `json:"picPath" example:"data:img/png;base64,///"` // base64 图像字符串 - CaptchaLength int `json:"captchaLength" example:"6"` // 验证码长度 + CaptchaId string `json:"captchaId" example:"axxbbas" comment:"随机数id"` // 随机数id + PicPath string `json:"picPath" example:"data:img/png;base64,///" comment:"base64 图像字符串"` // base64 图像字符串 + CaptchaLength int `json:"captchaLength" example:"6" comment:"验证码长度" ` // 验证码长度 } diff --git a/server/model/system/response/sys_casbin.go b/server/model/system/response/sys_casbin.go index 267bb42c9..9552a2f7a 100644 --- a/server/model/system/response/sys_casbin.go +++ b/server/model/system/response/sys_casbin.go @@ -5,5 +5,5 @@ import ( ) type PolicyPathResponse struct { - Paths []request.CasbinInfo `json:"paths"` + Paths []request.CasbinInfo `json:"paths" comment:"casbin详情列表"` } diff --git a/server/model/system/response/sys_menu.go b/server/model/system/response/sys_menu.go index d8f80f314..ba1fd81d6 100644 --- a/server/model/system/response/sys_menu.go +++ b/server/model/system/response/sys_menu.go @@ -3,13 +3,13 @@ package response import "github.com/flipped-aurora/gin-vue-admin/server/model/system" type SysMenusResponse struct { - Menus []system.SysMenu `json:"menus"` + Menus []system.SysMenu `json:"menus" comment:"系统菜单详情列表"` } type SysBaseMenusResponse struct { - Menus []system.SysBaseMenu `json:"menus"` + Menus []system.SysBaseMenu `json:"menus" comment:"系统菜单列表"` } type SysBaseMenuResponse struct { - Menu system.SysBaseMenu `json:"menu"` + Menu system.SysBaseMenu `json:"menu" comment:"系统菜单列表"` } diff --git a/server/model/system/response/sys_system.go b/server/model/system/response/sys_system.go index f19e965bf..8966abf2d 100644 --- a/server/model/system/response/sys_system.go +++ b/server/model/system/response/sys_system.go @@ -3,5 +3,5 @@ package response import "github.com/flipped-aurora/gin-vue-admin/server/config" type SysConfigResponse struct { - Config config.Server `json:"config"` + Config config.Server `json:"config" comment:"系统配置"` } diff --git a/server/model/system/response/sys_user.go b/server/model/system/response/sys_user.go index d6f1074b7..1deb2769c 100644 --- a/server/model/system/response/sys_user.go +++ b/server/model/system/response/sys_user.go @@ -5,11 +5,11 @@ import ( ) type SysUserResponse struct { - User system.SysUser `json:"user"` + User system.SysUser `json:"user" comment:"用户信息"` } type LoginResponse struct { - User system.SysUser `json:"user"` - Token string `json:"token"` - ExpiresAt int64 `json:"expiresAt"` + User system.SysUser `json:"user" comment:"用户信息"` + Token string `json:"token" comment:"token"` + ExpiresAt int64 `json:"expiresAt" comment:"过期时间"` }