@@ -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 | |||
} |
@@ -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" ` | |||
@@ -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": [ | |||
@@ -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": [ | |||
@@ -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: | |||