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

36 lines
779 B
Go
Raw Permalink Normal View History

2022-01-12 01:44:10 +08:00
package user
import (
2022-01-14 01:28:43 +08:00
"git.icechen.cn/monorepo/backend/app/zeus/service/lark/pkg/admin"
2022-01-13 14:28:50 +08:00
"git.icechen.cn/monorepo/backend/pkg/api"
2022-01-12 01:44:10 +08:00
"git.icechen.cn/monorepo/backend/pkg/proto/zeus/lark"
"git.icechen.cn/monorepo/backend/pkg/rpc"
"github.com/gofiber/fiber/v2"
)
2022-01-14 00:40:35 +08:00
// LoginHandle 管理员登录
2022-01-12 01:44:10 +08:00
func LoginHandle(c *fiber.Ctx) error {
var p = struct {
2022-01-14 00:40:35 +08:00
Code string `json:"code" validate:"required"`
2022-01-12 01:44:10 +08:00
}{}
2022-01-13 14:28:50 +08:00
err := api.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
}
2022-01-14 00:40:35 +08:00
return c.JSON(response)
}
2022-01-14 01:28:43 +08:00
// InfoHandle 管理员信息
func InfoHandle(c *fiber.Ctx) error {
userInfo := admin.GetUserInfo(c)
return c.JSON(userInfo)
2022-01-12 01:44:10 +08:00
}