From 97a57ce29eb1022bd1dec8361f0cece4a0881437 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Wed, 4 Dec 2024 17:17:07 +0800 Subject: [PATCH] update --- app/hdl/comm/hdl_comm.go | 30 +++++++++++++++++++ app/router/router.go | 7 +++-- docs/docs.go | 63 ++++++++++++++++++++++++++++++++++++++++ docs/swagger.json | 63 ++++++++++++++++++++++++++++++++++++++++ docs/swagger.yaml | 43 +++++++++++++++++++++++++++ 5 files changed, 203 insertions(+), 3 deletions(-) diff --git a/app/hdl/comm/hdl_comm.go b/app/hdl/comm/hdl_comm.go index b448e9c..346d4a8 100644 --- a/app/hdl/comm/hdl_comm.go +++ b/app/hdl/comm/hdl_comm.go @@ -298,3 +298,33 @@ func GetSTSVoucher(c *gin.Context) { return } + +type GetAdminInfoResp struct { + AdmId int `json:"adm_id"` // 管理员id + Username string `json:"username"` // 用户名 + State int `json:"state"` // 状态(1:正常 2:冻结) + IsSuperAdministrator int `json:"is_super_administrator"` // 是否为超级管理员(0:否 1:是) + Memo string `json:"memo"` // 备注信息 +} + +// GetAdminInfo +// @Summary 通用请求-获取管理员信息 +// @Tags 通用请求 +// @Description 获取管理员信息 +// @Accept json +// @Produce json +// @param Authorization header string true "验证参数Bearer和token空格拼接" +// @Success 200 {object} GetAdminInfoResp "管理员信息" +// @Failure 400 {object} md.Response "具体错误" +// @Router /api/comm/adminInfo [POST] +func GetAdminInfo(c *gin.Context) { + admin := svc.GetUser(c) + resp := GetAdminInfoResp{ + AdmId: admin.AdmId, + Username: admin.Username, + State: admin.State, + IsSuperAdministrator: admin.IsSuperAdministrator, + Memo: admin.Memo, + } + e.OutSuc(c, resp, nil) +} diff --git a/app/router/router.go b/app/router/router.go index 0929790..e07642b 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -361,7 +361,8 @@ func rFriendCircleSettings(r *gin.RouterGroup) { } func rComm(r *gin.RouterGroup) { - r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表 - r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL - r.GET("/getSTSVoucher", comm.GetSTSVoucher) + r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表 + r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL + r.GET("/getSTSVoucher", comm.GetSTSVoucher) // 获取 STS 凭证 + r.GET("/adminInfo", comm.GetAdminInfo) } diff --git a/docs/docs.go b/docs/docs.go index b61e026..c859487 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1295,6 +1295,44 @@ const docTemplate = `{ } } }, + "/api/comm/adminInfo": { + "post": { + "description": "获取管理员信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "通用请求" + ], + "summary": "通用请求-获取管理员信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "管理员信息", + "schema": { + "$ref": "#/definitions/comm.GetAdminInfoResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/comm/getOssUrl": { "post": { "description": "上传许可链接(获取)", @@ -7402,6 +7440,31 @@ const docTemplate = `{ } } }, + "comm.GetAdminInfoResp": { + "type": "object", + "properties": { + "adm_id": { + "description": "管理员id", + "type": "integer" + }, + "is_super_administrator": { + "description": "是否为超级管理员(0:否 1:是)", + "type": "integer" + }, + "memo": { + "description": "备注信息", + "type": "string" + }, + "state": { + "description": "状态(1:正常 2:冻结)", + "type": "integer" + }, + "username": { + "description": "用户名", + "type": "string" + } + } + }, "comm.GetSTSVoucherResp": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 55d74f8..08b8e2c 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1288,6 +1288,44 @@ } } }, + "/api/comm/adminInfo": { + "post": { + "description": "获取管理员信息", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "通用请求" + ], + "summary": "通用请求-获取管理员信息", + "parameters": [ + { + "type": "string", + "description": "验证参数Bearer和token空格拼接", + "name": "Authorization", + "in": "header", + "required": true + } + ], + "responses": { + "200": { + "description": "管理员信息", + "schema": { + "$ref": "#/definitions/comm.GetAdminInfoResp" + } + }, + "400": { + "description": "具体错误", + "schema": { + "$ref": "#/definitions/md.Response" + } + } + } + } + }, "/api/comm/getOssUrl": { "post": { "description": "上传许可链接(获取)", @@ -7395,6 +7433,31 @@ } } }, + "comm.GetAdminInfoResp": { + "type": "object", + "properties": { + "adm_id": { + "description": "管理员id", + "type": "integer" + }, + "is_super_administrator": { + "description": "是否为超级管理员(0:否 1:是)", + "type": "integer" + }, + "memo": { + "description": "备注信息", + "type": "string" + }, + "state": { + "description": "状态(1:正常 2:冻结)", + "type": "integer" + }, + "username": { + "description": "用户名", + "type": "string" + } + } + }, "comm.GetSTSVoucherResp": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 564403b..c276b3a 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -259,6 +259,24 @@ definitions: > Alibaba Cloud STS does not impose limits on the length of STS tokens. We strongly recommend that you do not specify a maximum length for STS tokens. type: string type: object + comm.GetAdminInfoResp: + properties: + adm_id: + description: 管理员id + type: integer + is_super_administrator: + description: 是否为超级管理员(0:否 1:是) + type: integer + memo: + description: 备注信息 + type: string + state: + description: 状态(1:正常 2:冻结) + type: integer + username: + description: 用户名 + type: string + type: object comm.GetSTSVoucherResp: properties: bucket: @@ -5486,6 +5504,31 @@ paths: summary: 云打包-图片配置 tags: - 云打包 + /api/comm/adminInfo: + post: + consumes: + - application/json + description: 获取管理员信息 + parameters: + - description: 验证参数Bearer和token空格拼接 + in: header + name: Authorization + required: true + type: string + produces: + - application/json + responses: + "200": + description: 管理员信息 + schema: + $ref: '#/definitions/comm.GetAdminInfoResp' + "400": + description: 具体错误 + schema: + $ref: '#/definitions/md.Response' + summary: 通用请求-获取管理员信息 + tags: + - 通用请求 /api/comm/getOssUrl: post: consumes: