generated from pkg/go-template
31 lines
690 B
Go
31 lines
690 B
Go
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 {
|
|
Code string `json:"code" validate:"required"`
|
|
Email string `json:"email" label:"邮箱" validate:"email"`
|
|
}{}
|
|
err := Bind(c, &p)
|
|
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)
|
|
}
|