diff --git a/app/zeus/api/lark/internal/user/user.go b/app/zeus/api/lark/internal/user/user.go index 943784b..f74ba83 100644 --- a/app/zeus/api/lark/internal/user/user.go +++ b/app/zeus/api/lark/internal/user/user.go @@ -5,14 +5,12 @@ import ( "git.icechen.cn/monorepo/backend/pkg/proto/zeus/lark" "git.icechen.cn/monorepo/backend/pkg/rpc" "github.com/gofiber/fiber/v2" - ctxLogger "github.com/luizsuper/ctxLoggers" - "go.uber.org/zap" ) +// LoginHandle 管理员登录 func LoginHandle(c *fiber.Ctx) error { var p = struct { - Code string `json:"code" validate:"required"` - Email string `json:"email" label:"邮箱" validate:"email"` + Code string `json:"code" validate:"required"` }{} err := api.Bind(c, &p) if err != nil { @@ -26,6 +24,25 @@ func LoginHandle(c *fiber.Ctx) error { return err } - ctxLogger.FInfo(c, "response", zap.Any("resp", response)) + return c.JSON(response) +} + +// UserInfoHandle 管理员信息 +func UserInfoHandle(c *fiber.Ctx) error { + var p = struct { + Token string `json:"token"` + }{} + err := api.Bind(c, &p) + if err != nil { + return err + } + + response, err := lark.NewUserClient(rpc.GetServiceConn("lark")).Info(c.Context(), &lark.InfoRequest{ + Token: p.Token, + }) + if err != nil { + return err + } + return c.JSON(response) } diff --git a/app/zeus/api/lark/main.go b/app/zeus/api/lark/main.go index c6216de..7173b9a 100755 --- a/app/zeus/api/lark/main.go +++ b/app/zeus/api/lark/main.go @@ -13,9 +13,11 @@ func main() { ErrorHandler: api.FiberMiddleWareErrHandler, }) router.Use(api.FibberMiddleWareRespHandler) + router.Use(api.FibberUserCtxWithTraceHandler) userRouter := router.Group("/user") userRouter.Post("/login", user.LoginHandle) + userRouter.Post("/info", user.UserInfoHandle) err := router.Listen(":8080") if err != nil {