feat: 封装中间件
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-01-14 01:28:43 +08:00
parent e033b49ba1
commit e932171ffa
3 changed files with 39 additions and 19 deletions
+5 -18
View File
@@ -1,6 +1,7 @@
package user
import (
"git.icechen.cn/monorepo/backend/app/zeus/service/lark/pkg/admin"
"git.icechen.cn/monorepo/backend/pkg/api"
"git.icechen.cn/monorepo/backend/pkg/proto/zeus/lark"
"git.icechen.cn/monorepo/backend/pkg/rpc"
@@ -27,22 +28,8 @@ func LoginHandle(c *fiber.Ctx) error {
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)
// InfoHandle 管理员信息
func InfoHandle(c *fiber.Ctx) error {
userInfo := admin.GetUserInfo(c)
return c.JSON(userInfo)
}