2023-06-04 22:54:54 +08:00

32 lines
621 B
Go

package apps
import (
"ai-gateway/common/constant"
"ai-gateway/common/dto"
"ai-gateway/common/utils"
"ai-gateway/infrastructure/repository"
"ai-gateway/service"
"github.com/labstack/echo/v4"
"net/http"
)
func InitUserGroup(g *echo.Group) {
g.POST("ai/login", func(c echo.Context) error {
req := new(dto.ThirdLoginReq)
if err := c.Bind(req); err != nil {
return c.JSON(500, err)
}
req.BizId = constant.BizIdAI.Val()
ctx := repository.GetFbc(&c)
token, err := service.Login.Login(ctx, *req)
if err != nil {
return c.JSON(500, err)
}
return c.JSON(http.StatusOK, utils.Ok(token))
})
}