Merge pull request #125 from yokowu/feat-admin-profile

feat: 管理员个人信息接口
This commit is contained in:
Yoko
2025-07-22 17:51:05 +08:00
committed by GitHub
2 changed files with 52 additions and 0 deletions

View File

@@ -282,6 +282,42 @@
}
}
},
"/api/v1/admin/profile": {
"get": {
"description": "管理员信息",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin"
],
"summary": "管理员信息",
"operationId": "admin-profile",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/web.Resp"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/domain.AdminUser"
}
}
}
]
}
}
}
}
},
"/api/v1/admin/setting": {
"get": {
"description": "获取系统设置",

View File

@@ -76,6 +76,7 @@ func NewUserHandler(
admin.GET("/setting", web.BaseHandler(u.GetSetting))
admin.Use(auth.Auth(), active.Active("admin"))
admin.GET("/profile", web.BaseHandler(u.AdminProfile))
admin.GET("/list", web.BaseHandler(u.AdminList, web.WithPage()))
admin.GET("/login-history", web.BaseHandler(u.AdminLoginHistory, web.WithPage()))
admin.PUT("/setting", web.BindHandler(u.UpdateSetting))
@@ -354,6 +355,21 @@ func (h *UserHandler) AdminLogout(c *web.Context) error {
return c.Success(nil)
}
// AdminProfile 管理员信息
//
// @Tags Admin
// @Summary 管理员信息
// @Description 管理员信息
// @ID admin-profile
// @Accept json
// @Produce json
// @Success 200 {object} web.Resp{data=domain.AdminUser}
// @Router /api/v1/admin/profile [get]
func (h *UserHandler) AdminProfile(c *web.Context) error {
user := middleware.GetAdmin(c)
return c.Success(user)
}
// List 获取用户列表
//
// @Tags User