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

36 lines
779 B
Go

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"
"github.com/gofiber/fiber/v2"
)
// LoginHandle 管理员登录
func LoginHandle(c *fiber.Ctx) error {
var p = struct {
Code string `json:"code" validate:"required"`
}{}
err := api.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
}
return c.JSON(response)
}
// InfoHandle 管理员信息
func InfoHandle(c *fiber.Ctx) error {
userInfo := admin.GetUserInfo(c)
return c.JSON(userInfo)
}