diff --git a/backend/docs/swagger.json b/backend/docs/swagger.json index 2c0f20e..076c68a 100644 --- a/backend/docs/swagger.json +++ b/backend/docs/swagger.json @@ -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": "获取系统设置", diff --git a/backend/internal/user/handler/v1/user.go b/backend/internal/user/handler/v1/user.go index a3d98ca..bc6db63 100644 --- a/backend/internal/user/handler/v1/user.go +++ b/backend/internal/user/handler/v1/user.go @@ -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