添加gorm的model结构一个表名的入口
This commit is contained in:
@@ -2,7 +2,6 @@ package handler
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
@@ -54,7 +53,6 @@ func UserGoogleLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
|
||||
}
|
||||
|
||||
log.Println(r.URL.String(), r.URL.Query())
|
||||
var req types.RequestGoogleLogin
|
||||
// 如果端点有请求结构体,则使用httpx.Parse方法从HTTP请求体中解析请求数据
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
@@ -65,12 +63,18 @@ func UserGoogleLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
logx.Info(err)
|
||||
return
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewUserGoogleLoginLogic(r.Context(), svcCtx)
|
||||
resp := l.UserGoogleLogin(&req, userinfo)
|
||||
|
||||
// 如果响应不为nil,则使用httpx.OkJsonCtx方法返回JSON响应;
|
||||
if resp != nil {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
if resp.IsRewriteHandler() {
|
||||
resp.RewriteHandler(w, r)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
} else {
|
||||
err := errors.New("server logic is error, resp must not be nil")
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
|
||||
Reference in New Issue
Block a user