From 9a691553df70ea76058de5ac648cd65a11a381ca Mon Sep 17 00:00:00 2001 From: dengbiao Date: Tue, 8 Oct 2024 17:18:33 +0800 Subject: [PATCH] update --- app/hdl/hdl_login.go | 11 ++++++++--- app/md/md_login.go | 2 +- docs/docs.go | 29 ++++++++++++++++++++++++++++- docs/swagger.json | 29 ++++++++++++++++++++++++++++- docs/swagger.yaml | 21 ++++++++++++++++++++- 5 files changed, 85 insertions(+), 7 deletions(-) diff --git a/app/hdl/hdl_login.go b/app/hdl/hdl_login.go index 00a251a..2c29154 100644 --- a/app/hdl/hdl_login.go +++ b/app/hdl/hdl_login.go @@ -66,13 +66,18 @@ func Login(c *gin.Context) { // @Accept json // @Produce json // @Param req body md.LoginReq true "用户名密码" -// @Success 200 {object} md.LoginResponse "token" +// @Success 200 {object} md.LoginInfoResponse "token" // @Failure 400 {object} md.Response "具体错误" // @Router /api/loginInfo [GET] func LoginInfo(c *gin.Context) { admin := svc.GetUser(c) - e.OutSuc(c, md.LoginResponse{ - Token: token, + e.OutSuc(c, md.LoginInfoResponse{ + AdmId: admin.AdmId, + Username: admin.Username, + IsSuperAdministrator: admin.IsSuperAdministrator, + Memo: admin.Memo, + CreateAt: admin.CreateAt, + UpdateAt: admin.UpdateAt, }, nil) return } diff --git a/app/md/md_login.go b/app/md/md_login.go index fe875a9..0a19d07 100644 --- a/app/md/md_login.go +++ b/app/md/md_login.go @@ -13,7 +13,7 @@ type LoginResponse struct { type LoginInfoResponse struct { AdmId int `json:"adm_id" ` // 管理员id Username string `json:"username" example:"登录账号"` - IsSuperAdministrator int `json:"is_super_administrator" example:"是否为超级管理员(0:否 1:是)"` + IsSuperAdministrator int `json:"is_super_administrator"` // 是否为超级管理员(0:否 1:是) Memo string `json:"memo" example:"备注信息"` CreateAt string `json:"create_at" ` UpdateAt string `json:"update_at" ` diff --git a/docs/docs.go b/docs/docs.go index 923d3f2..f693f4d 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -234,7 +234,7 @@ const docTemplate = `{ "200": { "description": "token", "schema": { - "$ref": "#/definitions/md.LoginResponse" + "$ref": "#/definitions/md.LoginInfoResponse" } }, "400": { @@ -1384,6 +1384,33 @@ const docTemplate = `{ } } }, + "md.LoginInfoResponse": { + "type": "object", + "properties": { + "adm_id": { + "description": "管理员id", + "type": "integer" + }, + "create_at": { + "type": "string" + }, + "is_super_administrator": { + "description": "是否为超级管理员(0:否 1:是)", + "type": "integer" + }, + "memo": { + "type": "string", + "example": "备注信息" + }, + "update_at": { + "type": "string" + }, + "username": { + "type": "string", + "example": "登录账号" + } + } + }, "md.LoginReq": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index 5d52826..b928ba7 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -226,7 +226,7 @@ "200": { "description": "token", "schema": { - "$ref": "#/definitions/md.LoginResponse" + "$ref": "#/definitions/md.LoginInfoResponse" } }, "400": { @@ -1376,6 +1376,33 @@ } } }, + "md.LoginInfoResponse": { + "type": "object", + "properties": { + "adm_id": { + "description": "管理员id", + "type": "integer" + }, + "create_at": { + "type": "string" + }, + "is_super_administrator": { + "description": "是否为超级管理员(0:否 1:是)", + "type": "integer" + }, + "memo": { + "type": "string", + "example": "备注信息" + }, + "update_at": { + "type": "string" + }, + "username": { + "type": "string", + "example": "登录账号" + } + } + }, "md.LoginReq": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8a0b690..01615ff 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -282,6 +282,25 @@ definitions: total: type: integer type: object + md.LoginInfoResponse: + properties: + adm_id: + description: 管理员id + type: integer + create_at: + type: string + is_super_administrator: + description: 是否为超级管理员(0:否 1:是) + type: integer + memo: + example: 备注信息 + type: string + update_at: + type: string + username: + example: 登录账号 + type: string + type: object md.LoginReq: properties: code: @@ -599,7 +618,7 @@ paths: "200": description: token schema: - $ref: '#/definitions/md.LoginResponse' + $ref: '#/definitions/md.LoginInfoResponse' "400": description: 具体错误 schema: