From 237ac665e642432e9ad1077139d4f36478c92aab Mon Sep 17 00:00:00 2001 From: Blizzard Date: Tue, 16 Sep 2025 14:27:32 +0800 Subject: [PATCH] feat: swagger --- api/v1/system/auth.go | 26 +- api/v1/system/sys_client.go | 59 +- api/v1/system/sys_menu.go | 59 + api/v1/system/sys_role.go | 53 + api/v1/system/sys_user.go | 63 + config-dev.yaml | 2 +- config-prod.yaml | 2 +- docs/docs.go | 1636 ++++++++++++++++++++++++++ docs/swagger.json | 1610 +++++++++++++++++++++++++ docs/swagger.yaml | 951 +++++++++++++++ global/model.go | 2 +- go.mod | 67 +- go.sum | 141 ++- initialize/router.go | 17 +- main.go | 10 +- middleware/operation.go | 77 ++ model/system/sys_operation_record.go | 2 +- router/system/client_router.go | 2 +- router/system/menu_router.go | 2 +- 19 files changed, 4690 insertions(+), 91 deletions(-) create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml create mode 100644 middleware/operation.go diff --git a/api/v1/system/auth.go b/api/v1/system/auth.go index a972d00..c61334b 100644 --- a/api/v1/system/auth.go +++ b/api/v1/system/auth.go @@ -17,7 +17,14 @@ var store = base64Captcha.DefaultMemStore type AuthApi struct{} -// Login api +// Login +// @Tags 登录相关 +// @Summary pc登录 +// @accept application/json +// @Produce application/json +// @Param data body systemReq.Login true "用户名, 密码, 验证码,验证码id" +// @Success 200 {object} response.Response{msg=string} "登录成功" +// @Router /api/auth/login [post] func (a *AuthApi) Login(c *gin.Context) { var l systemReq.Login err := c.ShouldBindJSON(&l) @@ -39,7 +46,13 @@ func (a *AuthApi) Login(c *gin.Context) { response.FailWithMsg("验证码错误", c) } -// 登出 +// Logout +// @Tags 登录相关 +// @Summary pc登出 +// @Security ApiKeyAuth +// @Produce application/json +// @Success 200 {object} response.Response{msg=string} "登出成功" +// @Router /api/auth/logout [get] func (a *AuthApi) Logout(c *gin.Context) { token := jwt.GetToken(c) userId := jwt.GetUserId(c) @@ -54,7 +67,12 @@ func (a *AuthApi) Logout(c *gin.Context) { } -// Captcha api 生成验证码 +// Captcha +// @Tags 登录相关 +// @Summary 获取验证码 +// @Produce application/json +// @Success 200 {object} response.Response{data=systemRes.CaptchaRes} "获取验证码" +// @Router /api/auth/captcha [get] func (u *AuthApi) Captcha(c *gin.Context) { var driver = base64Captcha.DriverString{ Height: 80, @@ -62,7 +80,7 @@ func (u *AuthApi) Captcha(c *gin.Context) { NoiseCount: 2, ShowLineOptions: 4, Length: 4, - Source: "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM", + Source: "1234567890", } cp := base64Captcha.NewCaptcha(&driver, store) diff --git a/api/v1/system/sys_client.go b/api/v1/system/sys_client.go index ee021f7..b40ef90 100644 --- a/api/v1/system/sys_client.go +++ b/api/v1/system/sys_client.go @@ -1,18 +1,28 @@ package system import ( - "github.com/gin-gonic/gin" - "go.uber.org/zap" "sundynix-go/global" "sundynix-go/model/commom/request" "sundynix-go/model/commom/response" "sundynix-go/model/system" systemReq "sundynix-go/model/system/request" + + "github.com/gin-gonic/gin" + "go.uber.org/zap" ) type ClientApi struct { } +// SaveClient +// @Tags 客户端管理 +// @Summary 创建client +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.Client true "client" +// @Success 200 {object} response.Response{msg=string} "创建client" +// @Router /api/client/save [post] func (s *ClientApi) SaveClient(c *gin.Context) { var client system.Client err := c.ShouldBindJSON(&client) @@ -29,6 +39,15 @@ func (s *ClientApi) SaveClient(c *gin.Context) { response.OkWithMsg("保存客户端成功!", c) } +// UpdateClient +// @Tags 客户端管理 +// @Summary 更新client +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.Client true "client" +// @Success 200 {object} response.Response{msg=string} "更新client" +// @Router /api/client/update [post] func (s *ClientApi) UpdateClient(c *gin.Context) { var client system.Client err := c.ShouldBindJSON(&client) @@ -45,6 +64,15 @@ func (s *ClientApi) UpdateClient(c *gin.Context) { response.OkWithMsg("更新客户端成功!", c) } +// GetClientList +// @Tags 客户端管理 +// @Summary 获取client列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.GetClientList true "client" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取client列表" +// @Router /api/client/getClientList [post] func (s *ClientApi) GetClientList(c *gin.Context) { var pageInfo systemReq.GetClientList err := c.ShouldBindJSON(&pageInfo) @@ -66,6 +94,15 @@ func (s *ClientApi) GetClientList(c *gin.Context) { }, c) } +// Delete +// @Tags 客户端管理 +// @Summary 删除client +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.IdsReq true "ids" +// @Success 200 {object} response.Response{msg=string} "删除client" +// @Router /api/client/delete [post] func (s *ClientApi) Delete(c *gin.Context) { var ids request.IdsReq err := c.ShouldBindJSON(&ids) @@ -82,14 +119,18 @@ func (s *ClientApi) Delete(c *gin.Context) { response.OkWithMsg("删除客户端成功!", c) } +// Detail +// @Tags 客户端管理 +// @Summary 获取client详情 +// @Description id获取详情 +// @Security ApiKeyAuth +// @Produce application/json +// @Param id query string true "id" +// @Success 200 {object} response.Response{data=system.Client,msg=string} "获取client详情" +// @Router /api/client/detail [get] func (s *ClientApi) Detail(c *gin.Context) { - var idInfo request.GetById - err := c.ShouldBindJSON(&idInfo) - if err != nil { - response.FailWithMsg(err.Error(), c) - return - } - client, err := clientService.GetClientById(idInfo.ID) + id := c.Query("id") + client, err := clientService.GetClientById(id) if err != nil { global.Logger.Error("获取客户端详情失败!", zap.Error(err)) response.FailWithMsg(err.Error(), c) diff --git a/api/v1/system/sys_menu.go b/api/v1/system/sys_menu.go index 6b4afee..8a90b87 100644 --- a/api/v1/system/sys_menu.go +++ b/api/v1/system/sys_menu.go @@ -14,6 +14,15 @@ import ( type MenuApi struct { } +// SaveMenu +// @Tags 菜单管理 +// @Summary 新增菜单 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.Menu false "menu" +// @Success 200 {object} response.Response{msg=string} "新建菜单/按钮" +// @Router /api/menu/save [post] func (m *MenuApi) SaveMenu(c *gin.Context) { var menu system.Menu err := c.ShouldBindJSON(&menu) @@ -30,6 +39,15 @@ func (m *MenuApi) SaveMenu(c *gin.Context) { } } +// UpdateMenu +// @Tags 菜单管理 +// @Summary 更新菜单 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.Menu false "menu" +// @Success 200 {object} response.Response{msg=string} "更新菜单" +// @Router /menu/update [post] func (m *MenuApi) UpdateMenu(c *gin.Context) { var menu system.Menu err := c.ShouldBindJSON(&menu) @@ -46,6 +64,15 @@ func (m *MenuApi) UpdateMenu(c *gin.Context) { } } +// DeleteMenu +// @Tags 菜单管理 +// @Summary 删除menu +// @Description 删除menu +// @Security ApiKeyAuth +// @Produce application/json +// @Param id query string true "id" +// @Success 200 {object} response.Response{msg=string} "详情" +// @Router /api/menu/delete [get] func (m *MenuApi) DeleteMenu(c *gin.Context) { id := c.Query("id") err := menuService.DeleteMenu(id) @@ -57,6 +84,15 @@ func (m *MenuApi) DeleteMenu(c *gin.Context) { response.OkWithMsg("删除菜单成功!", c) } +// Detail +// @Tags 菜单管理 +// @Summary 获取menu详情 +// @Description id获取详情 +// @Security ApiKeyAuth +// @Produce application/json +// @Param id query string true "id" +// @Success 200 {object} response.Response{data=system.Menu,msg=string} "详情" +// @Router /api/menu/detail [get] func (m *MenuApi) Detail(c *gin.Context) { id := c.Query("id") menu, err := menuService.GetMenuById(id) @@ -68,6 +104,15 @@ func (m *MenuApi) Detail(c *gin.Context) { response.OkWithData(menu, c) } +// GetAllMenuTree +// @Tags 菜单管理 +// @Summary 获取所有菜单树 +// @Security ApiKeyAuth +// @Accept json +// @Produce json +// @Param data body systemReq.GetMenuTree true "菜单信息" +// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "获取所有菜单树" +// @Router /api/menu/getAllMenuTree [post] func (m *MenuApi) GetAllMenuTree(c *gin.Context) { var param systemReq.GetMenuTree err := c.ShouldBindJSON(¶m) @@ -84,10 +129,24 @@ func (m *MenuApi) GetAllMenuTree(c *gin.Context) { response.OkWithData(menus, c) } +// GetUserMenuTree +// @Tags 菜单管理 +// @Summary 用户菜单数据 +// @Security ApiKeyAuth +// @Produce json +// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户菜单数据" +// @Router /api/menu/getUserMenuTree [get] func (m *MenuApi) GetUserMenuTree(c *gin.Context) { } +// Route +// @Tags 菜单管理 +// @Summary 用户路由 +// @Security ApiKeyAuth +// @Produce json +// @Success 200 {object} response.Response{data=[]system.Menu,msg=string} "用户route" +// @Router /api/menu/route [get] func (m *MenuApi) Route(c *gin.Context) { userId := jwt.GetUserId(c) routes, err := menuService.GetUserRoutes(userId) diff --git a/api/v1/system/sys_role.go b/api/v1/system/sys_role.go index 0d32d33..a97d52a 100644 --- a/api/v1/system/sys_role.go +++ b/api/v1/system/sys_role.go @@ -14,6 +14,15 @@ import ( type RoleApi struct { } +// SaveRole +// @tags 角色管理 +// @Summary 创建角色 +// @Security ApiKeyAuth +// @accept json +// @Produce json +// @Param data body system.Role true "角色信息" +// @Success 200 {object} response.Response +// @Router /api/role/save [post] func (a *RoleApi) SaveRole(context *gin.Context) { var role system.Role err := context.ShouldBindJSON(&role) @@ -30,6 +39,15 @@ func (a *RoleApi) SaveRole(context *gin.Context) { response.OkWithMsg("保存角色成功!", context) } +// UpdateRole +// @tags 角色管理 +// @Summary 修改角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.Role true "角色ID" +// @Success 200 {object} response.Response" +// @Router /api/role/update [post] func (a *RoleApi) UpdateRole(context *gin.Context) { var role system.Role err := context.ShouldBindJSON(&role) @@ -46,6 +64,15 @@ func (a *RoleApi) UpdateRole(context *gin.Context) { response.OkWithMsg("更新角色成功!", context) } +// GetRoleList +// @tags 角色管理 +// @Summary 获取角色列表 +// @Description 获取角色列表 +// @Accept application/json +// @Produce application/json +// @Param data body systemreq.GetRoleList true "页码, 每页大小, 搜索条件" +// @success 200 {object} response.Response{data=response.PageResult,msg=string} "获取角色列表,返回包括列表,总数,页码,每页大小" +// @Router /api/role/getRoleList [post] func (a *RoleApi) GetRoleList(c *gin.Context) { var pageInfo systemreq.GetRoleList err := c.ShouldBindJSON(&pageInfo) @@ -66,6 +93,15 @@ func (a *RoleApi) GetRoleList(c *gin.Context) { }, c) } +// Delete +// @Tags 角色管理 +// @Summary 删除角色 +// @Description 删除角色 +// @Accept application/json +// @Produce application/json +// @Param data body request.IdsReq true "批量删除角色" +// @Success 200 {object} response.Response{msg=string} "删除角色" +// @Router /api/role/delete [post] func (a *RoleApi) Delete(context *gin.Context) { var ids request.IdsReq err := context.ShouldBindJSON(&ids) @@ -82,6 +118,14 @@ func (a *RoleApi) Delete(context *gin.Context) { response.OkWithMsg("删除角色成功!", context) } +// Detail +// @Tags 角色管理 +// @Summary 角色详情 +// @Security ApiKeyAuth +// @Produce application/json +// @Param id query string true "id" +// @Success 200 {object} response.Response{data=system.Role} "角色详情" +// @Router /api/role/detail [get] func (a *RoleApi) Detail(context *gin.Context) { id := context.Query("id") role, err := roleService.GetRoleById(id) @@ -93,6 +137,15 @@ func (a *RoleApi) Detail(context *gin.Context) { response.OkWithData(role, context) } +// GrantMenu +// @tags 角色管理 +// @Summary 授权菜单给角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemreq.GrantMenu true "授权菜单给角色" +// @success 200 {object} response.Response "授权菜单给角色" +// @Router /api/role/grantMenu [post] func (a *RoleApi) GrantMenu(c *gin.Context) { var grantMenu systemreq.GrantMenu err := c.ShouldBindJSON(&grantMenu) diff --git a/api/v1/system/sys_user.go b/api/v1/system/sys_user.go index e10eb87..3e330e5 100644 --- a/api/v1/system/sys_user.go +++ b/api/v1/system/sys_user.go @@ -14,6 +14,15 @@ import ( type UserApi struct { } +// SaveUser +// @tags 用户管理 +// @Summary 新增用户 +// @Security ApiKeyAuth +// @accept json +// @Produce json +// @Param data body system.User true "用户信息" +// @Success 200 {object} response.Response "{"code": 200, "data": {}, "msg": "添加成功"}" +// @Router /api/user/save [post] func (u *UserApi) SaveUser(c *gin.Context) { var user system.User err := c.ShouldBindJSON(&user) @@ -29,6 +38,15 @@ func (u *UserApi) SaveUser(c *gin.Context) { } } +// UpdateUser +// @tags 用户管理 +// @Summary 更新用户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.User true "用户ID,用户信息" +// @Success 200 {object} response.Response "{"code": 200, "data": [...]}" +// @Router /api/user/update [post] func (u *UserApi) UpdateUser(c *gin.Context) { var user system.User err := c.ShouldBindJSON(&user) @@ -44,6 +62,15 @@ func (u *UserApi) UpdateUser(c *gin.Context) { } } +// GetUserList +// @tags 用户管理 +// @Summary 获取用户列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.GetUserList true "页码, 每页大小, 搜索条件" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取用户列表,返回包括列表,总数,页码,每页大小" +// @Router /api/user/getUserList [post] func (u *UserApi) GetUserList(c *gin.Context) { var pageInfo systemReq.GetUserList err := c.ShouldBindJSON(&pageInfo) @@ -65,6 +92,15 @@ func (u *UserApi) GetUserList(c *gin.Context) { }, c) } +// Delete +// @Tags 用户管理 +// @Summary 删除用户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.IdsReq true "批量删除用户" +// @Success 200 {object} response.Response{msg=string} "删除用户" +// @Router /api/user/delete [post] func (u *UserApi) Delete(c *gin.Context) { var ids request.IdsReq err := c.ShouldBindJSON(&ids) @@ -81,6 +117,14 @@ func (u *UserApi) Delete(c *gin.Context) { response.OkWithMsg("删除用户成功!", c) } +// Detail +// @Tags 用户管理 +// @Summary 获取用户详情 +// @Security ApiKeyAuth +// @Produce application/json +// @Param id query string true "id" +// @Success 200 {object} response.Response{data=system.User} "获取用户详情成功" +// @Router /api/user/detail [get] func (u *UserApi) Detail(c *gin.Context) { id := c.Query("id") user, err := userService.GetUserById(id) @@ -92,6 +136,16 @@ func (u *UserApi) Detail(c *gin.Context) { response.OkWithData(user, c) } +// ChangePassword +// @Tags 用户管理 +// @Summary 修改密码 +// @Security ApiKeyAuth +// @Description 修改密码 +// @accept json +// @Produce application/json +// @Param data body request.ChangePwd true "用户id" +// @Success 200 {object} response.Response{data=system.User} "修改密码成功" +// @Router /api/user/changePassword [post] func (u *UserApi) ChangePassword(c *gin.Context) { var changePwd systemReq.ChangePwd err := c.ShouldBindJSON(&changePwd) @@ -108,6 +162,15 @@ func (u *UserApi) ChangePassword(c *gin.Context) { response.OkWithMsg("修改密码成功", c) } +// GrantRole +// @Tags 用户管理 +// @Summary 给用户分配角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.GrantRole true "用户ID, 角色ID" +// @Success 200 {object} response.Response "{"code": 200, "data": [...]}" +// @Router /api/user/grantRole [post] func (u *UserApi) GrantRole(c *gin.Context) { var grantRole systemReq.GrantRole err := c.ShouldBindJSON(&grantRole) diff --git a/config-dev.yaml b/config-dev.yaml index 1ff847b..d22349d 100644 --- a/config-dev.yaml +++ b/config-dev.yaml @@ -1,5 +1,5 @@ system: - addr: 8888 + addr: 8889 db-type: mysql router-prefix: "api" enable-captcha: 0 diff --git a/config-prod.yaml b/config-prod.yaml index d13b040..eba3a84 100644 --- a/config-prod.yaml +++ b/config-prod.yaml @@ -17,7 +17,7 @@ mysql: log-zap: true max-idle-conns: 10 max-open-conns: 100 - host: 92.168.100.127 + host: 127.0.0.1 port: "3306" prefix: "sundynix-" singular: false diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 0000000..2395eab --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,1636 @@ +// 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}}", + "contact": {}, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/api/auth/captcha": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "登录相关" + ], + "summary": "获取验证码", + "responses": { + "200": { + "description": "获取验证码", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.CaptchaRes" + } + } + } + ] + } + } + } + } + }, + "/api/auth/login": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "登录相关" + ], + "summary": "pc登录", + "parameters": [ + { + "description": "用户名, 密码, 验证码,验证码id", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.Login" + } + } + ], + "responses": { + "200": { + "description": "登录成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/auth/logout": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "登录相关" + ], + "summary": "pc登出", + "responses": { + "200": { + "description": "登出成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/delete": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "删除client", + "parameters": [ + { + "description": "ids", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "删除client", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "id获取详情", + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "获取client详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "获取client详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.Client" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/getClientList": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "获取client列表", + "parameters": [ + { + "description": "client", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetClientList" + } + } + ], + "responses": { + "200": { + "description": "获取client列表", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "创建client", + "parameters": [ + { + "description": "client", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Client" + } + } + ], + "responses": { + "200": { + "description": "创建client", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "更新client", + "parameters": [ + { + "description": "client", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Client" + } + } + ], + "responses": { + "200": { + "description": "更新client", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/delete": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "删除menu", + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "删除menu", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "id获取详情", + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "获取menu详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.Menu" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/getAllMenuTree": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "获取所有菜单树", + "parameters": [ + { + "description": "菜单信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetMenuTree" + } + } + ], + "responses": { + "200": { + "description": "获取所有菜单树", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/getUserMenuTree": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "用户菜单数据", + "responses": { + "200": { + "description": "用户菜单数据", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/route": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "用户路由", + "responses": { + "200": { + "description": "用户route", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "新增菜单", + "parameters": [ + { + "description": "menu", + "name": "data", + "in": "body", + "schema": { + "$ref": "#/definitions/system.Menu" + } + } + ], + "responses": { + "200": { + "description": "新建菜单/按钮", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/role/delete": { + "post": { + "description": "删除角色", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "删除角色", + "parameters": [ + { + "description": "批量删除角色", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "删除角色", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/role/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "角色详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "角色详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.Role" + } + } + } + ] + } + } + } + } + }, + "/api/role/getRoleList": { + "post": { + "description": "获取角色列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "获取角色列表", + "parameters": [ + { + "description": "页码, 每页大小, 搜索条件", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetRoleList" + } + } + ], + "responses": { + "200": { + "description": "获取角色列表,返回包括列表,总数,页码,每页大小", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/role/grantMenu": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "授权菜单给角色", + "parameters": [ + { + "description": "授权菜单给角色", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GrantMenu" + } + } + ], + "responses": { + "200": { + "description": "授权菜单给角色", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/role/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "创建角色", + "parameters": [ + { + "description": "角色信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Role" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/role/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "修改角色", + "parameters": [ + { + "description": "角色ID", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Role" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/user/changePassword": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "修改密码", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "修改密码", + "parameters": [ + { + "description": "用户id", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.ChangePwd" + } + } + ], + "responses": { + "200": { + "description": "修改密码成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.User" + } + } + } + ] + } + } + } + } + }, + "/api/user/delete": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "删除用户", + "parameters": [ + { + "description": "批量删除用户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "删除用户", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/user/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "获取用户详情成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.User" + } + } + } + ] + } + } + } + } + }, + "/api/user/getUserList": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户列表", + "parameters": [ + { + "description": "页码, 每页大小, 搜索条件", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetUserList" + } + } + ], + "responses": { + "200": { + "description": "获取用户列表,返回包括列表,总数,页码,每页大小", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/user/grantRole": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "给用户分配角色", + "parameters": [ + { + "description": "用户ID, 角色ID", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GrantRole" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/user/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "新增用户", + "parameters": [ + { + "description": "用户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.User" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": {}, \"msg\": \"添加成功\"}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/user/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "更新用户", + "parameters": [ + { + "description": "用户ID,用户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.User" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/menu/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "更新菜单", + "parameters": [ + { + "description": "menu", + "name": "data", + "in": "body", + "schema": { + "$ref": "#/definitions/system.Menu" + } + } + ], + "responses": { + "200": { + "description": "更新菜单", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + } + }, + "definitions": { + "request.ChangePwd": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "newPwd": { + "type": "string" + } + } + }, + "request.GetClientList": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "current": { + "description": "页码", + "type": "integer" + }, + "keyword": { + "description": "关键字", + "type": "string" + }, + "name": { + "type": "string" + }, + "pageSize": { + "description": "每页大小", + "type": "integer" + } + } + }, + "request.GetMenuTree": { + "type": "object", + "properties": { + "category": { + "type": "integer" + }, + "parentId": { + "type": "string" + } + } + }, + "request.GetRoleList": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "current": { + "description": "页码", + "type": "integer" + }, + "keyword": { + "description": "关键字", + "type": "string" + }, + "name": { + "type": "string" + }, + "pageSize": { + "description": "每页大小", + "type": "integer" + } + } + }, + "request.GetUserList": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "current": { + "description": "页码", + "type": "integer" + }, + "keyword": { + "description": "关键字", + "type": "string" + }, + "pageSize": { + "description": "每页大小", + "type": "integer" + }, + "phone": { + "type": "string" + } + } + }, + "request.GrantMenu": { + "type": "object", + "properties": { + "menuIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "roleId": { + "type": "string" + } + } + }, + "request.GrantRole": { + "type": "object", + "properties": { + "roleIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "userId": { + "type": "string" + } + } + }, + "request.IdsReq": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "request.Login": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "response.CaptchaRes": { + "type": "object", + "properties": { + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + } + } + }, + "response.PageResult": { + "type": "object", + "properties": { + "list": {}, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "response.Response": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": {}, + "msg": { + "type": "string" + } + } + }, + "system.Client": { + "type": "object", + "properties": { + "activeTimeout": { + "type": "integer" + }, + "additionalInfo": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "grantType": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "system.Menu": { + "type": "object", + "properties": { + "category": { + "type": "integer" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "code": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "locale": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parentId": { + "type": "string" + }, + "permission": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "system.Role": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "menus": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "name": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "updatedAt": { + "type": "string" + } + } + }, + "system.User": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "phone": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Role" + } + }, + "tenantId": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "v1.0.0", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "RBAC Swagger API接口文档", + Description: "使用gin+gorm进行极速开发的全栈开发基础平台", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..0344a87 --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,1610 @@ +{ + "swagger": "2.0", + "info": { + "description": "使用gin+gorm进行极速开发的全栈开发基础平台", + "title": "RBAC Swagger API接口文档", + "contact": {}, + "version": "v1.0.0" + }, + "paths": { + "/api/auth/captcha": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "登录相关" + ], + "summary": "获取验证码", + "responses": { + "200": { + "description": "获取验证码", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.CaptchaRes" + } + } + } + ] + } + } + } + } + }, + "/api/auth/login": { + "post": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "登录相关" + ], + "summary": "pc登录", + "parameters": [ + { + "description": "用户名, 密码, 验证码,验证码id", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.Login" + } + } + ], + "responses": { + "200": { + "description": "登录成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/auth/logout": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "登录相关" + ], + "summary": "pc登出", + "responses": { + "200": { + "description": "登出成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/delete": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "删除client", + "parameters": [ + { + "description": "ids", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "删除client", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "id获取详情", + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "获取client详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "获取client详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.Client" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/getClientList": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "获取client列表", + "parameters": [ + { + "description": "client", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetClientList" + } + } + ], + "responses": { + "200": { + "description": "获取client列表", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "创建client", + "parameters": [ + { + "description": "client", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Client" + } + } + ], + "responses": { + "200": { + "description": "创建client", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/client/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "客户端管理" + ], + "summary": "更新client", + "parameters": [ + { + "description": "client", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Client" + } + } + ], + "responses": { + "200": { + "description": "更新client", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/delete": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "删除menu", + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "删除menu", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "id获取详情", + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "获取menu详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.Menu" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/getAllMenuTree": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "获取所有菜单树", + "parameters": [ + { + "description": "菜单信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetMenuTree" + } + } + ], + "responses": { + "200": { + "description": "获取所有菜单树", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/getUserMenuTree": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "用户菜单数据", + "responses": { + "200": { + "description": "用户菜单数据", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/route": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "用户路由", + "responses": { + "200": { + "description": "用户route", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/menu/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "新增菜单", + "parameters": [ + { + "description": "menu", + "name": "data", + "in": "body", + "schema": { + "$ref": "#/definitions/system.Menu" + } + } + ], + "responses": { + "200": { + "description": "新建菜单/按钮", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/role/delete": { + "post": { + "description": "删除角色", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "删除角色", + "parameters": [ + { + "description": "批量删除角色", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "删除角色", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/role/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "角色详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "角色详情", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.Role" + } + } + } + ] + } + } + } + } + }, + "/api/role/getRoleList": { + "post": { + "description": "获取角色列表", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "获取角色列表", + "parameters": [ + { + "description": "页码, 每页大小, 搜索条件", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetRoleList" + } + } + ], + "responses": { + "200": { + "description": "获取角色列表,返回包括列表,总数,页码,每页大小", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/role/grantMenu": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "授权菜单给角色", + "parameters": [ + { + "description": "授权菜单给角色", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GrantMenu" + } + } + ], + "responses": { + "200": { + "description": "授权菜单给角色", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/role/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "创建角色", + "parameters": [ + { + "description": "角色信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Role" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/role/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "角色管理" + ], + "summary": "修改角色", + "parameters": [ + { + "description": "角色ID", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.Role" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/user/changePassword": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "修改密码", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "修改密码", + "parameters": [ + { + "description": "用户id", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.ChangePwd" + } + } + ], + "responses": { + "200": { + "description": "修改密码成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.User" + } + } + } + ] + } + } + } + } + }, + "/api/user/delete": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "删除用户", + "parameters": [ + { + "description": "批量删除用户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "删除用户", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/user/detail": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户详情", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "query", + "required": true + } + ], + "responses": { + "200": { + "description": "获取用户详情成功", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/system.User" + } + } + } + ] + } + } + } + } + }, + "/api/user/getUserList": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "获取用户列表", + "parameters": [ + { + "description": "页码, 每页大小, 搜索条件", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GetUserList" + } + } + ], + "responses": { + "200": { + "description": "获取用户列表,返回包括列表,总数,页码,每页大小", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/api/user/grantRole": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "给用户分配角色", + "parameters": [ + { + "description": "用户ID, 角色ID", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.GrantRole" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/user/save": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "新增用户", + "parameters": [ + { + "description": "用户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.User" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": {}, \"msg\": \"添加成功\"}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/user/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "用户管理" + ], + "summary": "更新用户", + "parameters": [ + { + "description": "用户ID,用户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.User" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/menu/update": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "菜单管理" + ], + "summary": "更新菜单", + "parameters": [ + { + "description": "menu", + "name": "data", + "in": "body", + "schema": { + "$ref": "#/definitions/system.Menu" + } + } + ], + "responses": { + "200": { + "description": "更新菜单", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + } + }, + "definitions": { + "request.ChangePwd": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "newPwd": { + "type": "string" + } + } + }, + "request.GetClientList": { + "type": "object", + "properties": { + "clientId": { + "type": "string" + }, + "current": { + "description": "页码", + "type": "integer" + }, + "keyword": { + "description": "关键字", + "type": "string" + }, + "name": { + "type": "string" + }, + "pageSize": { + "description": "每页大小", + "type": "integer" + } + } + }, + "request.GetMenuTree": { + "type": "object", + "properties": { + "category": { + "type": "integer" + }, + "parentId": { + "type": "string" + } + } + }, + "request.GetRoleList": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "current": { + "description": "页码", + "type": "integer" + }, + "keyword": { + "description": "关键字", + "type": "string" + }, + "name": { + "type": "string" + }, + "pageSize": { + "description": "每页大小", + "type": "integer" + } + } + }, + "request.GetUserList": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "current": { + "description": "页码", + "type": "integer" + }, + "keyword": { + "description": "关键字", + "type": "string" + }, + "pageSize": { + "description": "每页大小", + "type": "integer" + }, + "phone": { + "type": "string" + } + } + }, + "request.GrantMenu": { + "type": "object", + "properties": { + "menuIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "roleId": { + "type": "string" + } + } + }, + "request.GrantRole": { + "type": "object", + "properties": { + "roleIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "userId": { + "type": "string" + } + } + }, + "request.IdsReq": { + "type": "object", + "properties": { + "ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "request.Login": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + }, + "password": { + "type": "string" + } + } + }, + "response.CaptchaRes": { + "type": "object", + "properties": { + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + } + } + }, + "response.PageResult": { + "type": "object", + "properties": { + "list": {}, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "total": { + "type": "integer" + } + } + }, + "response.Response": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "data": {}, + "msg": { + "type": "string" + } + } + }, + "system.Client": { + "type": "object", + "properties": { + "activeTimeout": { + "type": "integer" + }, + "additionalInfo": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "grantType": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "name": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "system.Menu": { + "type": "object", + "properties": { + "category": { + "type": "integer" + }, + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "code": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "locale": { + "type": "string" + }, + "name": { + "type": "string" + }, + "parentId": { + "type": "string" + }, + "permission": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + }, + "system.Role": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "menus": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Menu" + } + }, + "name": { + "type": "string" + }, + "sort": { + "type": "integer" + }, + "updatedAt": { + "type": "string" + } + } + }, + "system.User": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "clientId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "id": { + "description": "主键ID", + "type": "string" + }, + "phone": { + "type": "string" + }, + "roles": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Role" + } + }, + "tenantId": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "ApiKeyAuth": { + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 0000000..99c99b0 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,951 @@ +definitions: + request.ChangePwd: + properties: + id: + type: string + newPwd: + type: string + type: object + request.GetClientList: + properties: + clientId: + type: string + current: + description: 页码 + type: integer + keyword: + description: 关键字 + type: string + name: + type: string + pageSize: + description: 每页大小 + type: integer + type: object + request.GetMenuTree: + properties: + category: + type: integer + parentId: + type: string + type: object + request.GetRoleList: + properties: + code: + type: string + current: + description: 页码 + type: integer + keyword: + description: 关键字 + type: string + name: + type: string + pageSize: + description: 每页大小 + type: integer + type: object + request.GetUserList: + properties: + account: + type: string + current: + description: 页码 + type: integer + keyword: + description: 关键字 + type: string + pageSize: + description: 每页大小 + type: integer + phone: + type: string + type: object + request.GrantMenu: + properties: + menuIds: + items: + type: string + type: array + roleId: + type: string + type: object + request.GrantRole: + properties: + roleIds: + items: + type: string + type: array + userId: + type: string + type: object + request.IdsReq: + properties: + ids: + items: + type: string + type: array + type: object + request.Login: + properties: + account: + type: string + captcha: + type: string + captchaId: + type: string + password: + type: string + type: object + response.CaptchaRes: + properties: + captcha: + type: string + captchaId: + type: string + type: object + response.PageResult: + properties: + list: {} + page: + type: integer + pageSize: + type: integer + total: + type: integer + type: object + response.Response: + properties: + code: + type: integer + data: {} + msg: + type: string + type: object + system.Client: + properties: + activeTimeout: + type: integer + additionalInfo: + type: string + clientId: + type: string + createdAt: + type: string + grantType: + type: string + id: + description: 主键ID + type: string + name: + type: string + updatedAt: + type: string + type: object + system.Menu: + properties: + category: + type: integer + children: + items: + $ref: '#/definitions/system.Menu' + type: array + code: + type: string + createdAt: + type: string + icon: + type: string + id: + description: 主键ID + type: string + locale: + type: string + name: + type: string + parentId: + type: string + permission: + type: string + sort: + type: integer + title: + type: string + updatedAt: + type: string + type: object + system.Role: + properties: + code: + type: string + createdAt: + type: string + id: + description: 主键ID + type: string + menus: + items: + $ref: '#/definitions/system.Menu' + type: array + name: + type: string + sort: + type: integer + updatedAt: + type: string + type: object + system.User: + properties: + account: + type: string + clientId: + type: string + createdAt: + type: string + id: + description: 主键ID + type: string + phone: + type: string + roles: + items: + $ref: '#/definitions/system.Role' + type: array + tenantId: + type: string + updatedAt: + type: string + type: object +info: + contact: {} + description: 使用gin+gorm进行极速开发的全栈开发基础平台 + title: RBAC Swagger API接口文档 + version: v1.0.0 +paths: + /api/auth/captcha: + get: + produces: + - application/json + responses: + "200": + description: 获取验证码 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/response.CaptchaRes' + type: object + summary: 获取验证码 + tags: + - 登录相关 + /api/auth/login: + post: + consumes: + - application/json + parameters: + - description: 用户名, 密码, 验证码,验证码id + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.Login' + produces: + - application/json + responses: + "200": + description: 登录成功 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + summary: pc登录 + tags: + - 登录相关 + /api/auth/logout: + get: + produces: + - application/json + responses: + "200": + description: 登出成功 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: pc登出 + tags: + - 登录相关 + /api/client/delete: + post: + consumes: + - application/json + parameters: + - description: ids + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.IdsReq' + produces: + - application/json + responses: + "200": + description: 删除client + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 删除client + tags: + - 客户端管理 + /api/client/detail: + get: + description: id获取详情 + parameters: + - description: id + in: query + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取client详情 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/system.Client' + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 获取client详情 + tags: + - 客户端管理 + /api/client/getClientList: + post: + consumes: + - application/json + parameters: + - description: client + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.GetClientList' + produces: + - application/json + responses: + "200": + description: 获取client列表 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/response.PageResult' + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 获取client列表 + tags: + - 客户端管理 + /api/client/save: + post: + consumes: + - application/json + parameters: + - description: client + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.Client' + produces: + - application/json + responses: + "200": + description: 创建client + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 创建client + tags: + - 客户端管理 + /api/client/update: + post: + consumes: + - application/json + parameters: + - description: client + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.Client' + produces: + - application/json + responses: + "200": + description: 更新client + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 更新client + tags: + - 客户端管理 + /api/menu/delete: + get: + description: 删除menu + parameters: + - description: id + in: query + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 详情 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 删除menu + tags: + - 菜单管理 + /api/menu/detail: + get: + description: id获取详情 + parameters: + - description: id + in: query + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 详情 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/system.Menu' + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 获取menu详情 + tags: + - 菜单管理 + /api/menu/getAllMenuTree: + post: + consumes: + - application/json + parameters: + - description: 菜单信息 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.GetMenuTree' + produces: + - application/json + responses: + "200": + description: 获取所有菜单树 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + items: + $ref: '#/definitions/system.Menu' + type: array + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 获取所有菜单树 + tags: + - 菜单管理 + /api/menu/getUserMenuTree: + get: + produces: + - application/json + responses: + "200": + description: 用户菜单数据 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + items: + $ref: '#/definitions/system.Menu' + type: array + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 用户菜单数据 + tags: + - 菜单管理 + /api/menu/route: + get: + produces: + - application/json + responses: + "200": + description: 用户route + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + items: + $ref: '#/definitions/system.Menu' + type: array + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 用户路由 + tags: + - 菜单管理 + /api/menu/save: + post: + consumes: + - application/json + parameters: + - description: menu + in: body + name: data + schema: + $ref: '#/definitions/system.Menu' + produces: + - application/json + responses: + "200": + description: 新建菜单/按钮 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 新增菜单 + tags: + - 菜单管理 + /api/role/delete: + post: + consumes: + - application/json + description: 删除角色 + parameters: + - description: 批量删除角色 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.IdsReq' + produces: + - application/json + responses: + "200": + description: 删除角色 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + summary: 删除角色 + tags: + - 角色管理 + /api/role/detail: + get: + parameters: + - description: id + in: query + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 角色详情 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/system.Role' + type: object + security: + - ApiKeyAuth: [] + summary: 角色详情 + tags: + - 角色管理 + /api/role/getRoleList: + post: + consumes: + - application/json + description: 获取角色列表 + parameters: + - description: 页码, 每页大小, 搜索条件 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.GetRoleList' + produces: + - application/json + responses: + "200": + description: 获取角色列表,返回包括列表,总数,页码,每页大小 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/response.PageResult' + msg: + type: string + type: object + summary: 获取角色列表 + tags: + - 角色管理 + /api/role/grantMenu: + post: + consumes: + - application/json + parameters: + - description: 授权菜单给角色 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.GrantMenu' + produces: + - application/json + responses: + "200": + description: 授权菜单给角色 + schema: + $ref: '#/definitions/response.Response' + security: + - ApiKeyAuth: [] + summary: 授权菜单给角色 + tags: + - 角色管理 + /api/role/save: + post: + consumes: + - application/json + parameters: + - description: 角色信息 + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.Role' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + security: + - ApiKeyAuth: [] + summary: 创建角色 + tags: + - 角色管理 + /api/role/update: + post: + consumes: + - application/json + parameters: + - description: 角色ID + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.Role' + produces: + - application/json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + security: + - ApiKeyAuth: [] + summary: 修改角色 + tags: + - 角色管理 + /api/user/changePassword: + post: + consumes: + - application/json + description: 修改密码 + parameters: + - description: 用户id + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.ChangePwd' + produces: + - application/json + responses: + "200": + description: 修改密码成功 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/system.User' + type: object + security: + - ApiKeyAuth: [] + summary: 修改密码 + tags: + - 用户管理 + /api/user/delete: + post: + consumes: + - application/json + parameters: + - description: 批量删除用户 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.IdsReq' + produces: + - application/json + responses: + "200": + description: 删除用户 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 删除用户 + tags: + - 用户管理 + /api/user/detail: + get: + parameters: + - description: id + in: query + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 获取用户详情成功 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/system.User' + type: object + security: + - ApiKeyAuth: [] + summary: 获取用户详情 + tags: + - 用户管理 + /api/user/getUserList: + post: + consumes: + - application/json + parameters: + - description: 页码, 每页大小, 搜索条件 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.GetUserList' + produces: + - application/json + responses: + "200": + description: 获取用户列表,返回包括列表,总数,页码,每页大小 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + data: + $ref: '#/definitions/response.PageResult' + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 获取用户列表 + tags: + - 用户管理 + /api/user/grantRole: + post: + consumes: + - application/json + parameters: + - description: 用户ID, 角色ID + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.GrantRole' + produces: + - application/json + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/response.Response' + security: + - ApiKeyAuth: [] + summary: 给用户分配角色 + tags: + - 用户管理 + /api/user/save: + post: + consumes: + - application/json + parameters: + - description: 用户信息 + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.User' + produces: + - application/json + responses: + "200": + description: '{"code": 200, "data": {}, "msg": "添加成功"}' + schema: + $ref: '#/definitions/response.Response' + security: + - ApiKeyAuth: [] + summary: 新增用户 + tags: + - 用户管理 + /api/user/update: + post: + consumes: + - application/json + parameters: + - description: 用户ID,用户信息 + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.User' + produces: + - application/json + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/response.Response' + security: + - ApiKeyAuth: [] + summary: 更新用户 + tags: + - 用户管理 + /menu/update: + post: + consumes: + - application/json + parameters: + - description: menu + in: body + name: data + schema: + $ref: '#/definitions/system.Menu' + produces: + - application/json + responses: + "200": + description: 更新菜单 + schema: + allOf: + - $ref: '#/definitions/response.Response' + - properties: + msg: + type: string + type: object + security: + - ApiKeyAuth: [] + summary: 更新菜单 + tags: + - 菜单管理 +securityDefinitions: + ApiKeyAuth: + in: header + name: Authorization + type: apiKey +swagger: "2.0" diff --git a/global/model.go b/global/model.go index 5ea42cb..28f17f4 100644 --- a/global/model.go +++ b/global/model.go @@ -11,7 +11,7 @@ type BaseModel struct { Id string `gorm:"size:50;primaryKey" json:"id"` // 主键ID CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` - DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt"` // 删除时间 + DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间 } // BeforeCreate 定义一个钩子,在创建之前执行自动插入字段 diff --git a/go.mod b/go.mod index 8f634d6..40a9005 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,24 @@ module sundynix-go -go 1.24 +go 1.24.0 + +toolchain go1.24.2 require ( github.com/fsnotify/fsnotify v1.8.0 + github.com/gin-gonic/gin v1.10.1 github.com/glebarez/sqlite v1.11.0 + github.com/golang-jwt/jwt/v5 v5.2.2 + github.com/google/uuid v1.6.0 + github.com/mojocn/base64Captcha v1.3.8 + github.com/redis/go-redis/v9 v9.7.3 github.com/spf13/viper v1.20.1 + github.com/swaggo/files v1.0.1 + github.com/swaggo/gin-swagger v1.6.1 + github.com/swaggo/swag v1.16.6 go.uber.org/zap v1.27.0 + golang.org/x/crypto v0.42.0 + golang.org/x/sync v0.17.0 gorm.io/driver/mysql v1.5.7 gorm.io/driver/postgres v1.5.11 gorm.io/gorm v1.26.0 @@ -14,42 +26,55 @@ require ( require ( filippo.io/edwards25519 v1.1.0 // indirect - github.com/bytedance/sonic v1.13.2 // indirect - github.com/bytedance/sonic/loader v0.2.4 // indirect + github.com/KyleBanks/depth v1.2.1 // indirect + github.com/bytedance/gopkg v0.1.3 // indirect + github.com/bytedance/sonic v1.14.1 // indirect + github.com/bytedance/sonic/loader v0.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/cloudwego/base64x v0.1.5 // indirect - github.com/cloudwego/iasm v0.2.0 // indirect + github.com/cloudwego/base64x v0.1.6 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/gabriel-vasile/mimetype v1.4.9 // indirect + github.com/gabriel-vasile/mimetype v1.4.10 // indirect github.com/gin-contrib/sse v1.1.0 // indirect - github.com/gin-gonic/gin v1.10.0 // indirect github.com/glebarez/go-sqlite v1.22.0 // indirect + github.com/go-openapi/jsonpointer v0.22.0 // indirect + github.com/go-openapi/jsonreference v0.21.1 // indirect + github.com/go-openapi/spec v0.21.0 // indirect + github.com/go-openapi/swag v0.24.1 // indirect + github.com/go-openapi/swag/cmdutils v0.24.0 // indirect + github.com/go-openapi/swag/conv v0.24.0 // indirect + github.com/go-openapi/swag/fileutils v0.24.0 // indirect + github.com/go-openapi/swag/jsonname v0.24.0 // indirect + github.com/go-openapi/swag/jsonutils v0.24.0 // indirect + github.com/go-openapi/swag/loading v0.24.0 // indirect + github.com/go-openapi/swag/mangling v0.24.0 // indirect + github.com/go-openapi/swag/netutils v0.24.0 // indirect + github.com/go-openapi/swag/stringutils v0.24.0 // indirect + github.com/go-openapi/swag/typeutils v0.24.0 // indirect + github.com/go-openapi/swag/yamlutils v0.24.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.26.0 // indirect + github.com/go-playground/validator/v10 v10.27.0 // indirect github.com/go-sql-driver/mysql v1.9.2 // indirect github.com/go-viper/mapstructure/v2 v2.2.1 // indirect github.com/goccy/go-json v0.10.5 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgx/v5 v5.7.4 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect + github.com/mailru/easyjson v0.9.1 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/mojocn/base64Captcha v1.3.8 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect - github.com/redis/go-redis/v9 v9.7.3 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -58,17 +83,17 @@ require ( github.com/spf13/pflag v1.0.6 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.12 // indirect + github.com/ugorji/go/codec v1.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/arch v0.16.0 // indirect - golang.org/x/crypto v0.37.0 // indirect + golang.org/x/arch v0.21.0 // indirect golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect golang.org/x/image v0.26.0 // indirect - golang.org/x/net v0.39.0 // indirect - golang.org/x/sync v0.13.0 // indirect - golang.org/x/sys v0.32.0 // indirect - golang.org/x/text v0.24.0 // indirect - google.golang.org/protobuf v1.36.6 // indirect + golang.org/x/mod v0.28.0 // indirect + golang.org/x/net v0.44.0 // indirect + golang.org/x/sys v0.36.0 // indirect + golang.org/x/text v0.29.0 // indirect + golang.org/x/tools v0.37.0 // indirect + google.golang.org/protobuf v1.36.9 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect modernc.org/libc v1.64.0 // indirect modernc.org/mathutil v1.7.1 // indirect diff --git a/go.sum b/go.sum index d13e006..970f016 100644 --- a/go.sum +++ b/go.sum @@ -1,16 +1,21 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ= -github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= -github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= -github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= +github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= +github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= +github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= +github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= +github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= +github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= +github.com/bytedance/sonic v1.14.1 h1:FBMC0zVz5XUmE4z9wF4Jey0An5FueFvOsTKKKtwIl7w= +github.com/bytedance/sonic v1.14.1/go.mod h1:gi6uhQLMbTdeP0muCnrjHLeCUPyb70ujhnNlhOylAFc= +github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= +github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= -github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= -github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= -github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= +github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -22,22 +27,56 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= -github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= +github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0= +github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= +github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4= +github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= -github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= -github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= +github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ= +github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ= github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc= github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw= github.com/glebarez/sqlite v1.11.0/go.mod h1:h8/o8j5wiAsqSPoWELDUdJXhjAhsVliSn7bWZjOhrgQ= +github.com/go-openapi/jsonpointer v0.22.0 h1:TmMhghgNef9YXxTu1tOopo+0BGEytxA+okbry0HjZsM= +github.com/go-openapi/jsonpointer v0.22.0/go.mod h1:xt3jV88UtExdIkkL7NloURjRQjbeUgcxFblMjq2iaiU= +github.com/go-openapi/jsonreference v0.21.1 h1:bSKrcl8819zKiOgxkbVNRUBIr6Wwj9KYrDbMjRs0cDA= +github.com/go-openapi/jsonreference v0.21.1/go.mod h1:PWs8rO4xxTUqKGu+lEvvCxD5k2X7QYkKAepJyCmSTT8= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/swag v0.24.1 h1:DPdYTZKo6AQCRqzwr/kGkxJzHhpKxZ9i/oX0zag+MF8= +github.com/go-openapi/swag v0.24.1/go.mod h1:sm8I3lCPlspsBBwUm1t5oZeWZS0s7m/A+Psg0ooRU0A= +github.com/go-openapi/swag/cmdutils v0.24.0 h1:KlRCffHwXFI6E5MV9n8o8zBRElpY4uK4yWyAMWETo9I= +github.com/go-openapi/swag/cmdutils v0.24.0/go.mod h1:uxib2FAeQMByyHomTlsP8h1TtPd54Msu2ZDU/H5Vuf8= +github.com/go-openapi/swag/conv v0.24.0 h1:ejB9+7yogkWly6pnruRX45D1/6J+ZxRu92YFivx54ik= +github.com/go-openapi/swag/conv v0.24.0/go.mod h1:jbn140mZd7EW2g8a8Y5bwm8/Wy1slLySQQ0ND6DPc2c= +github.com/go-openapi/swag/fileutils v0.24.0 h1:U9pCpqp4RUytnD689Ek/N1d2N/a//XCeqoH508H5oak= +github.com/go-openapi/swag/fileutils v0.24.0/go.mod h1:3SCrCSBHyP1/N+3oErQ1gP+OX1GV2QYFSnrTbzwli90= +github.com/go-openapi/swag/jsonname v0.24.0 h1:2wKS9bgRV/xB8c62Qg16w4AUiIrqqiniJFtZGi3dg5k= +github.com/go-openapi/swag/jsonname v0.24.0/go.mod h1:GXqrPzGJe611P7LG4QB9JKPtUZ7flE4DOVechNaDd7Q= +github.com/go-openapi/swag/jsonutils v0.24.0 h1:F1vE1q4pg1xtO3HTyJYRmEuJ4jmIp2iZ30bzW5XgZts= +github.com/go-openapi/swag/jsonutils v0.24.0/go.mod h1:vBowZtF5Z4DDApIoxcIVfR8v0l9oq5PpYRUuteVu6f0= +github.com/go-openapi/swag/loading v0.24.0 h1:ln/fWTwJp2Zkj5DdaX4JPiddFC5CHQpvaBKycOlceYc= +github.com/go-openapi/swag/loading v0.24.0/go.mod h1:gShCN4woKZYIxPxbfbyHgjXAhO61m88tmjy0lp/LkJk= +github.com/go-openapi/swag/mangling v0.24.0 h1:PGOQpViCOUroIeak/Uj/sjGAq9LADS3mOyjznmHy2pk= +github.com/go-openapi/swag/mangling v0.24.0/go.mod h1:Jm5Go9LHkycsz0wfoaBDkdc4CkpuSnIEf62brzyCbhc= +github.com/go-openapi/swag/netutils v0.24.0 h1:Bz02HRjYv8046Ycg/w80q3g9QCWeIqTvlyOjQPDjD8w= +github.com/go-openapi/swag/netutils v0.24.0/go.mod h1:WRgiHcYTnx+IqfMCtu0hy9oOaPR0HnPbmArSRN1SkZM= +github.com/go-openapi/swag/stringutils v0.24.0 h1:i4Z/Jawf9EvXOLUbT97O0HbPUja18VdBxeadyAqS1FM= +github.com/go-openapi/swag/stringutils v0.24.0/go.mod h1:5nUXB4xA0kw2df5PRipZDslPJgJut+NjL7D25zPZ/4w= +github.com/go-openapi/swag/typeutils v0.24.0 h1:d3szEGzGDf4L2y1gYOSSLeK6h46F+zibnEas2Jm/wIw= +github.com/go-openapi/swag/typeutils v0.24.0/go.mod h1:q8C3Kmk/vh2VhpCLaoR2MVWOGP8y7Jc8l82qCTd1DYI= +github.com/go-openapi/swag/yamlutils v0.24.0 h1:bhw4894A7Iw6ne+639hsBNRHg9iZg/ISrOVr+sJGp4c= +github.com/go-openapi/swag/yamlutils v0.24.0/go.mod h1:DpKv5aYuaGm/sULePoeiG8uwMpZSfReo1HR3Ik0yaG8= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= -github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= +github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= +github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-sql-driver/mysql v1.9.2 h1:4cNKDYQ1I84SXslGddlsrMhc8k4LeDVj6Ad6WRjiHuU= github.com/go-sql-driver/mysql v1.9.2/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= @@ -49,8 +88,9 @@ github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeD github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= @@ -68,18 +108,20 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= -github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= +github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= +github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8= +github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -91,8 +133,6 @@ github.com/mojocn/base64Captcha v1.3.8 h1:rrN9BhCwXKS8ht1e21kvR3iTaMgf4qPC9sRoV5 github.com/mojocn/base64Captcha v1.3.8/go.mod h1:QFZy927L8HVP3+VV5z2b1EAEiv1KxVJKZbAucVgLUy4= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= -github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= -github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -101,8 +141,8 @@ github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0 github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo= github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= @@ -123,14 +163,20 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= +github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= +github.com/swaggo/gin-swagger v1.6.1 h1:Ri06G4gc9N4t4k8hekMigJ9zKTFSlqj/9paAQCQs7cY= +github.com/swaggo/gin-swagger v1.6.1/go.mod h1:LQ+hJStHakCWRiK/YNYtJOu4mR2FP+pxLnILT/qNiTw= +github.com/swaggo/swag v1.16.6 h1:qBNcx53ZaX+M5dxVyTrgQ0PJ/ACK+NzhwcbieTt+9yI= +github.com/swaggo/swag v1.16.6/go.mod h1:ngP2etMK5a0P3QBizic5MEwpRmluJZPHjXcMoj4Xesg= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= -github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= +github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= @@ -138,15 +184,15 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/arch v0.16.0 h1:foMtLTdyOmIniqWCHjY6+JxuC54XP1fDwx4N0ASyW+U= -golang.org/x/arch v0.16.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= +golang.org/x/arch v0.21.0 h1:iTC9o7+wP6cPWpDWkivCvQFGAHDQ59SrSxsLPcnkArw= +golang.org/x/arch v0.21.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE= -golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc= +golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI= +golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8= golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM= golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8= golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY= @@ -157,18 +203,19 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= -golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U= +golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.39.0 h1:ZCu7HMWDxpXpaiKdhzIfaltL9Lp31x/3fCP11bc6/fY= -golang.org/x/net v0.39.0/go.mod h1:X7NRbYVEA+ewNkCNyJ513WmMdQ3BineSwVtN2zD/d+E= +golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= +golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -176,8 +223,8 @@ golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610= -golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -189,8 +236,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= -golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -208,19 +255,19 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0= -golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.32.0 h1:Q7N1vhpkQv7ybVzLFtTjvQya2ewbwNDZzUgfXGqtMWU= -golang.org/x/tools v0.32.0/go.mod h1:ZxrU41P/wAbZD8EDa6dDCa6XfpkhJ7HFMjHJXfBDu8s= +golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE= +golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -258,5 +305,3 @@ modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/initialize/router.go b/initialize/router.go index e4f5e70..fb414b0 100644 --- a/initialize/router.go +++ b/initialize/router.go @@ -2,11 +2,15 @@ package initialize import ( "fmt" - "github.com/gin-gonic/gin" - "go.uber.org/zap" + "sundynix-go/docs" "sundynix-go/global" "sundynix-go/middleware" "sundynix-go/router" + + "github.com/gin-gonic/gin" + swaggerFiles "github.com/swaggo/files" + ginSwagger "github.com/swaggo/gin-swagger" + "go.uber.org/zap" ) // Routers 初始化总路由 @@ -17,6 +21,8 @@ func Routers() { if gin.Mode() == gin.DebugMode { Router.Use(gin.Logger()) } + docs.SwaggerInfo.BasePath = global.Config.System.RouterPrefix + Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) // 系统组路由 systemRouter := router.GroupApp.System @@ -41,6 +47,13 @@ func Routers() { } address := fmt.Sprintf(":%d", global.Config.System.Addr) + fmt.Printf(` + 欢迎使用 sundynix-go + 项目地址: + 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html + 默认前端文件运行地址:http://127.0.0.1:8080 +`, address) + err := Router.Run(address) if err != nil { global.Logger.Error("Gin run failed", zap.Error(err)) diff --git a/main.go b/main.go index 09fd56e..837fd88 100644 --- a/main.go +++ b/main.go @@ -3,12 +3,20 @@ package main import ( "context" "database/sql" - "go.uber.org/zap" "sundynix-go/core" "sundynix-go/global" "sundynix-go/initialize" + + "go.uber.org/zap" ) +// @title RBAC Swagger API接口文档 +// @version v1.0.0 +// @description 使用gin+gorm进行极速开发的全栈开发基础平台 +// @securityDefinitions.apikey ApiKeyAuth +// @in header +// @name Authorization +// @BasePath / func main() { //初始化viper global.Viper = core.Viper() diff --git a/middleware/operation.go b/middleware/operation.go new file mode 100644 index 0000000..9ce39eb --- /dev/null +++ b/middleware/operation.go @@ -0,0 +1,77 @@ +package middleware + +import ( + "bytes" + "encoding/json" + "io" + "net/http" + "net/url" + "strings" + "sundynix-go/global" + "sundynix-go/model/system" + "sundynix-go/service" + "sundynix-go/utils/jwt" + "sync" + + "github.com/gin-gonic/gin" + "go.uber.org/zap" +) + +var operationService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService + +var respPool sync.Pool +var bufferSize = 1024 + +func init() { + respPool = sync.Pool{ + New: func() interface{} { + return make([]byte, bufferSize) + }, + } +} + +func OperationRecord() gin.HandlerFunc { + return func(c *gin.Context) { + var body []byte + var userId string + if c.Request.Method != http.MethodGet { + var err error + body, err = io.ReadAll(c.Request.Body) + if err != nil { + global.Logger.Error("read body from request error:", zap.Error(err)) + } else { + c.Request.Body = io.NopCloser(bytes.NewBuffer(body)) + } + } else { + query := c.Request.URL.RawQuery + query, _ = url.QueryUnescape(query) + split := strings.Split(query, "&") + m := make(map[string]string) + for _, v := range split { + kv := strings.Split(v, "=") + if len(kv) == 2 { + m[kv[0]] = kv[1] + } + } + body, _ = json.Marshal(&m) + } + claims, _ := jwt.GetClaims(c) + if claims != nil && claims.BaseClaims.ID != "" { + userId = claims.BaseClaims.ID + } else { + userId = c.Request.Header.Get("x-user-id") + } + record := system.SysOperationRecord{ + Ip: c.ClientIP(), + Method: c.Request.Method, + Path: c.Request.URL.Path, + Agent: c.Request.UserAgent(), + Body: string(body), + UserId: userId, + } + + if err := operationService.CreateOperationRecord(record); err != nil { + global.Logger.Error("create operation record error:", zap.Error(err)) + } + } +} diff --git a/model/system/sys_operation_record.go b/model/system/sys_operation_record.go index 3787f0d..f979edc 100644 --- a/model/system/sys_operation_record.go +++ b/model/system/sys_operation_record.go @@ -16,6 +16,6 @@ type SysOperationRecord struct { ErrorMessage string `json:"erroMessage" form:"error_message" gorm:"column:error_message;comment:错误信息"` // 错误信息 Body string `json:"body" form:"body" gorm:"type:text;column:body;comment:请求Body"` // 请求Body Resp string `json:"resp" form:"resp" gorm:"type:text;column:resp;comment:响应Body"` // 响应Body - UserID int `json:"userId" form:"user_id" gorm:"column:user_id;comment:用户id"` // 用户id + UserId string `json:"userId" form:"user_id" gorm:"column:user_id;comment:用户id"` // 用户id User User `json:"user"` } diff --git a/router/system/client_router.go b/router/system/client_router.go index 2b03fde..fbbc9b4 100644 --- a/router/system/client_router.go +++ b/router/system/client_router.go @@ -11,7 +11,7 @@ func (s *ClientRouter) InitClientRouter(Router *gin.RouterGroup) { clientRouter.POST("save", clientApi.SaveClient) clientRouter.POST("update", clientApi.UpdateClient) clientRouter.POST("getClientList", clientApi.GetClientList) - clientRouter.GET("delete", clientApi.Delete) + clientRouter.POST("delete", clientApi.Delete) clientRouter.GET("detail", clientApi.Detail) } } diff --git a/router/system/menu_router.go b/router/system/menu_router.go index 0bf678a..033f473 100644 --- a/router/system/menu_router.go +++ b/router/system/menu_router.go @@ -10,7 +10,7 @@ func (m *MenuRouter) InitMenuRouter(Router *gin.RouterGroup) { { menuRouter.GET("route", menuApi.Route) menuRouter.POST("getAllMenuTree", menuApi.GetAllMenuTree) - menuRouter.POST("getUserMenuTree", menuApi.GetUserMenuTree) + menuRouter.GET("getUserMenuTree", menuApi.GetUserMenuTree) menuRouter.POST("save", menuApi.SaveMenu) menuRouter.POST("update", menuApi.UpdateMenu) menuRouter.GET("delete", menuApi.DeleteMenu)