generated from pkg/go-template
32 lines
657 B
Go
32 lines
657 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"
|
||
|
)
|
||
|
|
||
|
var ErrorUser = fiber.NewError(0, "错误")
|
||
|
|
||
|
func LoginHandle(c *fiber.Ctx) error {
|
||
|
var p = struct {
|
||
|
Code string `json:"code"`
|
||
|
}{}
|
||
|
err := c.BodyParser(&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)
|
||
|
}
|