添加gorm的model结构一个表名的入口

This commit is contained in:
eson
2023-07-20 10:13:18 +08:00
parent 20a7149eb6
commit 6264440017
91 changed files with 624 additions and 208 deletions

View File

@@ -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)