backend/app/zeus/api/lark/internal/user/user.go

31 lines
690 B
Go
Raw Normal View History

2022-01-12 01:44:10 +08:00
package user
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"
)
func LoginHandle(c *fiber.Ctx) error {
var p = struct {
2022-01-13 02:23:00 +08:00
Code string `json:"code" validate:"required"`
2022-01-13 02:33:44 +08:00
Email string `json:"email" label:"邮箱" validate:"email"`
2022-01-12 01:44:10 +08:00
}{}
2022-01-13 02:23:00 +08:00
err := Bind(c, &p)
2022-01-12 01:44:10 +08:00
if err != nil {
return err
}
response, err := lark.NewUserClient(rpc.GetServiceConn("lark")).Login(c.Context(), &lark.LoginRequest{
Code: p.Code,
})
if err != nil {
return err
}
ctxLogger.FInfo(c, "response", zap.Any("resp", response))
return c.JSON(response)
}