From 7ec78d1c3519e27333e932972cb61ac359f2f148 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Mon, 24 Jul 2023 13:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=B0=83=E6=95=B4w,r?= =?UTF-8?q?=E7=9A=84=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goctl_template/api/handler.tpl | 2 +- goctl_template/api/logic.tpl | 5 +++-- goctl_template_backend/api/handler.tpl | 2 +- goctl_template_backend/api/logic.tpl | 6 ++++-- server/assistant/internal/handler/redirecthandler.go | 2 +- server/assistant/internal/logic/redirectlogic.go | 2 +- server/backend/internal/handler/quotationdetailhandler.go | 2 +- server/canteen/internal/handler/getcanteendetailhandler.go | 2 +- .../internal/handler/savecanteentypeproducthandler.go | 2 +- .../internal/handler/getqrcodesetlisthandler.go | 2 +- .../internal/handler/getstandardlogolisthandler.go | 2 +- .../home-user-auth/internal/handler/acceptcookiehandler.go | 2 +- .../internal/handler/useraddaddresshandler.go | 2 +- .../internal/handler/useraddresslisthandler.go | 2 +- .../home-user-auth/internal/handler/userbasicinfohandler.go | 2 +- .../internal/handler/usercontactservicehandler.go | 2 +- .../internal/handler/useremailregisterhandler.go | 2 +- server/home-user-auth/internal/handler/userfontshandler.go | 2 +- .../home-user-auth/internal/handler/usergettypehandler.go | 2 +- .../internal/handler/usergoogleloginhandler.go | 2 +- server/home-user-auth/internal/handler/userloginhandler.go | 2 +- .../internal/handler/useroderdeletehandler.go | 2 +- .../internal/handler/userordercancelhandler.go | 2 +- .../home-user-auth/internal/handler/userorderlisthandler.go | 2 +- .../internal/handler/usersavebasicinfohandler.go | 2 +- .../internal/handler/userstatusconfighandler.go | 2 +- .../home-user-auth/internal/logic/useremailregisterlogic.go | 2 +- .../home-user-auth/internal/logic/usergoogleloginlogic.go | 2 +- server/home-user-auth/internal/logic/userloginlogic.go | 6 ++---- server/inventory/internal/handler/getcloudlisthandler.go | 2 +- server/inventory/internal/handler/getpickuplisthandler.go | 2 +- server/inventory/internal/handler/supplementhandler.go | 2 +- server/inventory/internal/handler/takehandler.go | 2 +- .../internal/handler/getmaplibrarylisthandler.go | 2 +- .../map-library/internal/handler/savemaplibraryhandler.go | 2 +- server/orders/internal/handler/getorderdetailhandler.go | 2 +- server/orders/internal/handler/getorderinvoicehandler.go | 2 +- .../product-model/internal/handler/getmodeldetailhandler.go | 2 +- .../internal/handler/getmodelotherinfohandler.go | 2 +- .../internal/handler/updateproductmodelhandler.go | 2 +- .../product-template/internal/handler/addbasemaphandler.go | 2 +- .../internal/handler/getbasemaplisthandler.go | 2 +- .../internal/handler/gettemplatevdetailhandler.go | 2 +- .../product-template/internal/handler/savebasemaphandler.go | 2 +- .../internal/handler/updatetemplatehandler.go | 2 +- server/product/internal/handler/designgatherhandler.go | 2 +- server/product/internal/handler/getfittingbypidhandler.go | 2 +- .../product/internal/handler/getlastproductdesignhandler.go | 2 +- server/product/internal/handler/getlightbypidhandler.go | 2 +- server/product/internal/handler/getmodelbypidhandler.go | 2 +- server/product/internal/handler/getpricebypidhandler.go | 2 +- server/product/internal/handler/getproductdesignhandler.go | 2 +- server/product/internal/handler/getproductinfohandler.go | 2 +- server/product/internal/handler/getproductlisthandler.go | 2 +- .../internal/handler/getrecommandproductlisthandler.go | 2 +- server/product/internal/handler/getrenderdesignhandler.go | 2 +- .../internal/handler/getrendersettingbypidhandler.go | 2 +- server/product/internal/handler/getsizebypidhandler.go | 2 +- server/product/internal/handler/getsizebyproducthandler.go | 2 +- .../product/internal/handler/getsuccessrecommandhandler.go | 2 +- server/product/internal/handler/gettagproductlisthandler.go | 2 +- server/product/internal/handler/gettemplatebypidhandler.go | 2 +- .../internal/handler/homepagerecommendproductlisthandler.go | 2 +- server/product/internal/handler/otherproductlisthandler.go | 2 +- server/product/internal/handler/savedesignhandler.go | 2 +- server/render/internal/handler/readimageshandler.go | 2 +- server/render/internal/handler/tounityhandler.go | 2 +- server/render/internal/logic/readimageslogic.go | 2 +- server/render/internal/logic/tounitylogic.go | 2 +- .../internal/handler/cartaddhandler.go | 2 +- .../internal/handler/cartdeletehandler.go | 2 +- .../internal/handler/cartlisthandler.go | 2 +- .../internal/handler/cartnumberhandler.go | 2 +- .../internal/handler/cartorderdetailhandler.go | 2 +- .../internal/handler/changeordermethodhandler.go | 2 +- .../internal/handler/createorderhandler.go | 2 +- server/upload/internal/handler/uploadfilefrontendhandler.go | 2 +- server/upload/internal/handler/uploadqrcodehandler.go | 2 +- server/upload/internal/handler/uploadupfilehandler.go | 2 +- server/webset/internal/handler/websetsettinghandler.go | 2 +- server/webset/internal/logic/websetsettinglogic.go | 2 +- utils/basic/request_parse.go | 4 ++-- 82 files changed, 89 insertions(+), 88 deletions(-) diff --git a/goctl_template/api/handler.tpl b/goctl_template/api/handler.tpl index 1a6b35da..604bf136 100644 --- a/goctl_template/api/handler.tpl +++ b/goctl_template/api/handler.tpl @@ -26,7 +26,7 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc { {{if .HasResp}}resp{{end}} := l.{{.Call}}({{if .HasRequest}}&req, {{end}}userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/goctl_template/api/logic.tpl b/goctl_template/api/logic.tpl index e1504e4e..63413717 100644 --- a/goctl_template/api/logic.tpl +++ b/goctl_template/api/logic.tpl @@ -25,8 +25,9 @@ func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) *{{.logic}} // func (l *{{.logic}}) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } -// 处理逻辑后 w,r 如:重定向 -// func (l *{{.logic}}) AfterLogic(w http.ResponseWriter, r *http.Request) { +// 处理逻辑后 w,r 如:重定向, resp 必须重新处理 +// func (l *{{.logic}}) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// // httpx.OkJsonCtx(r.Context(), w, resp) // } func (l *{{.logic}}) {{.function}}({{.request}}, userinfo *auth.UserInfo) (resp *basic.Response) { diff --git a/goctl_template_backend/api/handler.tpl b/goctl_template_backend/api/handler.tpl index 4b289117..f836b128 100644 --- a/goctl_template_backend/api/handler.tpl +++ b/goctl_template_backend/api/handler.tpl @@ -25,7 +25,7 @@ func {{.HandlerName}}(svcCtx *svc.ServiceContext) http.HandlerFunc { {{if .HasResp}}resp{{end}} := l.{{.Call}}({{if .HasRequest}}&req, {{end}}userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/goctl_template_backend/api/logic.tpl b/goctl_template_backend/api/logic.tpl index e1504e4e..d32190f1 100644 --- a/goctl_template_backend/api/logic.tpl +++ b/goctl_template_backend/api/logic.tpl @@ -25,10 +25,12 @@ func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) *{{.logic}} // func (l *{{.logic}}) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } -// 处理逻辑后 w,r 如:重定向 -// func (l *{{.logic}}) AfterLogic(w http.ResponseWriter, r *http.Request) { +// 处理逻辑后 w,r 如:重定向, resp 必须重新处理 +// func (l *{{.logic}}) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// // httpx.OkJsonCtx(r.Context(), w, resp) // } + func (l *{{.logic}}) {{.function}}({{.request}}, userinfo *auth.UserInfo) (resp *basic.Response) { // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) // userinfo 传入值时, 一定不为null diff --git a/server/assistant/internal/handler/redirecthandler.go b/server/assistant/internal/handler/redirecthandler.go index c309c6d9..ec6724de 100644 --- a/server/assistant/internal/handler/redirecthandler.go +++ b/server/assistant/internal/handler/redirecthandler.go @@ -28,7 +28,7 @@ func RedirectHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.Redirect(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/assistant/internal/logic/redirectlogic.go b/server/assistant/internal/logic/redirectlogic.go index e913a752..a637f429 100644 --- a/server/assistant/internal/logic/redirectlogic.go +++ b/server/assistant/internal/logic/redirectlogic.go @@ -36,7 +36,7 @@ func NewRedirectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Redirect // } // 处理逻辑后 w,r 如:重定向 -func (l *RedirectLogic) AfterLogic(w http.ResponseWriter, r *http.Request) { +func (l *RedirectLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { if l.RedirectUrl != "" { html := fmt.Sprintf(` diff --git a/server/backend/internal/handler/quotationdetailhandler.go b/server/backend/internal/handler/quotationdetailhandler.go index ce9928ea..adbb9621 100644 --- a/server/backend/internal/handler/quotationdetailhandler.go +++ b/server/backend/internal/handler/quotationdetailhandler.go @@ -27,7 +27,7 @@ func QuotationDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.QuotationDetail(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/canteen/internal/handler/getcanteendetailhandler.go b/server/canteen/internal/handler/getcanteendetailhandler.go index 24bfc2cb..81ac03df 100644 --- a/server/canteen/internal/handler/getcanteendetailhandler.go +++ b/server/canteen/internal/handler/getcanteendetailhandler.go @@ -28,7 +28,7 @@ func GetCanteenDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetCanteenDetail(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/canteen/internal/handler/savecanteentypeproducthandler.go b/server/canteen/internal/handler/savecanteentypeproducthandler.go index 9cce2b29..5ca34dda 100644 --- a/server/canteen/internal/handler/savecanteentypeproducthandler.go +++ b/server/canteen/internal/handler/savecanteentypeproducthandler.go @@ -28,7 +28,7 @@ func SaveCanteenTypeProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc resp := l.SaveCanteenTypeProduct(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/data-transfer/internal/handler/getqrcodesetlisthandler.go b/server/data-transfer/internal/handler/getqrcodesetlisthandler.go index a5dedcf2..050c768c 100644 --- a/server/data-transfer/internal/handler/getqrcodesetlisthandler.go +++ b/server/data-transfer/internal/handler/getqrcodesetlisthandler.go @@ -28,7 +28,7 @@ func GetQrCodeSetListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetQrCodeSetList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/data-transfer/internal/handler/getstandardlogolisthandler.go b/server/data-transfer/internal/handler/getstandardlogolisthandler.go index 48716664..db38259d 100644 --- a/server/data-transfer/internal/handler/getstandardlogolisthandler.go +++ b/server/data-transfer/internal/handler/getstandardlogolisthandler.go @@ -28,7 +28,7 @@ func GetStandardLogoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetStandardLogoList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/acceptcookiehandler.go b/server/home-user-auth/internal/handler/acceptcookiehandler.go index ea24b81b..88e8944a 100644 --- a/server/home-user-auth/internal/handler/acceptcookiehandler.go +++ b/server/home-user-auth/internal/handler/acceptcookiehandler.go @@ -28,7 +28,7 @@ func AcceptCookieHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.AcceptCookie(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/useraddaddresshandler.go b/server/home-user-auth/internal/handler/useraddaddresshandler.go index 5b2c6c3d..84354a6d 100644 --- a/server/home-user-auth/internal/handler/useraddaddresshandler.go +++ b/server/home-user-auth/internal/handler/useraddaddresshandler.go @@ -28,7 +28,7 @@ func UserAddAddressHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserAddAddress(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/useraddresslisthandler.go b/server/home-user-auth/internal/handler/useraddresslisthandler.go index f0e51bf7..9060da40 100644 --- a/server/home-user-auth/internal/handler/useraddresslisthandler.go +++ b/server/home-user-auth/internal/handler/useraddresslisthandler.go @@ -28,7 +28,7 @@ func UserAddressListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserAddressList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/userbasicinfohandler.go b/server/home-user-auth/internal/handler/userbasicinfohandler.go index 070fc961..85e7ca17 100644 --- a/server/home-user-auth/internal/handler/userbasicinfohandler.go +++ b/server/home-user-auth/internal/handler/userbasicinfohandler.go @@ -28,7 +28,7 @@ func UserBasicInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserBasicInfo(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/usercontactservicehandler.go b/server/home-user-auth/internal/handler/usercontactservicehandler.go index 3e1129b5..511d170f 100644 --- a/server/home-user-auth/internal/handler/usercontactservicehandler.go +++ b/server/home-user-auth/internal/handler/usercontactservicehandler.go @@ -28,7 +28,7 @@ func UserContactServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserContactService(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/useremailregisterhandler.go b/server/home-user-auth/internal/handler/useremailregisterhandler.go index a245432e..5d274809 100644 --- a/server/home-user-auth/internal/handler/useremailregisterhandler.go +++ b/server/home-user-auth/internal/handler/useremailregisterhandler.go @@ -28,7 +28,7 @@ func UserEmailRegisterHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserEmailRegister(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/userfontshandler.go b/server/home-user-auth/internal/handler/userfontshandler.go index 04ce08bf..a98156e2 100644 --- a/server/home-user-auth/internal/handler/userfontshandler.go +++ b/server/home-user-auth/internal/handler/userfontshandler.go @@ -28,7 +28,7 @@ func UserFontsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserFonts(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/usergettypehandler.go b/server/home-user-auth/internal/handler/usergettypehandler.go index c1b6fef4..9558f557 100644 --- a/server/home-user-auth/internal/handler/usergettypehandler.go +++ b/server/home-user-auth/internal/handler/usergettypehandler.go @@ -28,7 +28,7 @@ func UserGetTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserGetType(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/usergoogleloginhandler.go b/server/home-user-auth/internal/handler/usergoogleloginhandler.go index 07e3c998..154b2450 100644 --- a/server/home-user-auth/internal/handler/usergoogleloginhandler.go +++ b/server/home-user-auth/internal/handler/usergoogleloginhandler.go @@ -28,7 +28,7 @@ func UserGoogleLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserGoogleLogin(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/userloginhandler.go b/server/home-user-auth/internal/handler/userloginhandler.go index e880a060..d08232d6 100644 --- a/server/home-user-auth/internal/handler/userloginhandler.go +++ b/server/home-user-auth/internal/handler/userloginhandler.go @@ -28,7 +28,7 @@ func UserLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserLogin(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/useroderdeletehandler.go b/server/home-user-auth/internal/handler/useroderdeletehandler.go index cd21c047..91cd7501 100644 --- a/server/home-user-auth/internal/handler/useroderdeletehandler.go +++ b/server/home-user-auth/internal/handler/useroderdeletehandler.go @@ -28,7 +28,7 @@ func UserOderDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserOderDelete(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/userordercancelhandler.go b/server/home-user-auth/internal/handler/userordercancelhandler.go index f0065089..65402d98 100644 --- a/server/home-user-auth/internal/handler/userordercancelhandler.go +++ b/server/home-user-auth/internal/handler/userordercancelhandler.go @@ -28,7 +28,7 @@ func UserOrderCancelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserOrderCancel(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/userorderlisthandler.go b/server/home-user-auth/internal/handler/userorderlisthandler.go index e31f6ff8..f59f11da 100644 --- a/server/home-user-auth/internal/handler/userorderlisthandler.go +++ b/server/home-user-auth/internal/handler/userorderlisthandler.go @@ -28,7 +28,7 @@ func UserOrderListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserOrderList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/usersavebasicinfohandler.go b/server/home-user-auth/internal/handler/usersavebasicinfohandler.go index 362999fb..c29d60ab 100644 --- a/server/home-user-auth/internal/handler/usersavebasicinfohandler.go +++ b/server/home-user-auth/internal/handler/usersavebasicinfohandler.go @@ -28,7 +28,7 @@ func UserSaveBasicInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserSaveBasicInfo(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/handler/userstatusconfighandler.go b/server/home-user-auth/internal/handler/userstatusconfighandler.go index 63447b0c..bb70d0d3 100644 --- a/server/home-user-auth/internal/handler/userstatusconfighandler.go +++ b/server/home-user-auth/internal/handler/userstatusconfighandler.go @@ -28,7 +28,7 @@ func UserStatusConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UserStatusConfig(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/home-user-auth/internal/logic/useremailregisterlogic.go b/server/home-user-auth/internal/logic/useremailregisterlogic.go index 34c29487..eb276e5b 100644 --- a/server/home-user-auth/internal/logic/useremailregisterlogic.go +++ b/server/home-user-auth/internal/logic/useremailregisterlogic.go @@ -31,7 +31,7 @@ func NewUserEmailRegisterLogic(ctx context.Context, svcCtx *svc.ServiceContext) // } // 处理逻辑后 w,r 如:重定向 -// func (l *UserEmailRegisterLogic) AfterLogic(w http.ResponseWriter, r *http.Request) { +// func (l *UserEmailRegisterLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // } func (l *UserEmailRegisterLogic) UserEmailRegister(req *types.RequestEmailRegister, userinfo *auth.UserInfo) (resp *basic.Response) { diff --git a/server/home-user-auth/internal/logic/usergoogleloginlogic.go b/server/home-user-auth/internal/logic/usergoogleloginlogic.go index 50b7683b..8c31f753 100644 --- a/server/home-user-auth/internal/logic/usergoogleloginlogic.go +++ b/server/home-user-auth/internal/logic/usergoogleloginlogic.go @@ -45,7 +45,7 @@ func NewUserGoogleLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *U // log.Println(r, w) // } -func (l *UserGoogleLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request) { +func (l *UserGoogleLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { rurl := fmt.Sprintf( l.svcCtx.Config.MainAddress+"/oauth?token=%s&is_registered=%t®ister_token=%s", diff --git a/server/home-user-auth/internal/logic/userloginlogic.go b/server/home-user-auth/internal/logic/userloginlogic.go index 24d0b669..a8900591 100644 --- a/server/home-user-auth/internal/logic/userloginlogic.go +++ b/server/home-user-auth/internal/logic/userloginlogic.go @@ -23,7 +23,6 @@ type UserLoginLogic struct { svcCtx *svc.ServiceContext token string - resp *basic.Response } func NewUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLoginLogic { @@ -34,12 +33,12 @@ func NewUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLog } } -func (l *UserLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request) { +func (l *UserLoginLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { if l.token != "" { w.Header().Add("Authorization", fmt.Sprintf("Bearer %s", l.token)) } - httpx.OkJsonCtx(r.Context(), w, l.resp) + httpx.OkJsonCtx(r.Context(), w, resp) } func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin, userinfo *auth.UserInfo) (resp *basic.Response) { @@ -79,7 +78,6 @@ func (l *UserLoginLogic) UserLogin(req *types.RequestUserLogin, userinfo *auth.U } l.token = jwtToken - l.resp = resp.SetStatus(basic.CodeOK, data) // 返回认证成功的状态码以及数据对象 data 和 JWT Token。 return resp.SetStatus(basic.CodeOK, data) diff --git a/server/inventory/internal/handler/getcloudlisthandler.go b/server/inventory/internal/handler/getcloudlisthandler.go index 436c1bca..90708969 100644 --- a/server/inventory/internal/handler/getcloudlisthandler.go +++ b/server/inventory/internal/handler/getcloudlisthandler.go @@ -28,7 +28,7 @@ func GetCloudListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetCloudList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/inventory/internal/handler/getpickuplisthandler.go b/server/inventory/internal/handler/getpickuplisthandler.go index 6d1c2ff4..ffe7fb4f 100644 --- a/server/inventory/internal/handler/getpickuplisthandler.go +++ b/server/inventory/internal/handler/getpickuplisthandler.go @@ -28,7 +28,7 @@ func GetPickupListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetPickupList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/inventory/internal/handler/supplementhandler.go b/server/inventory/internal/handler/supplementhandler.go index 0e5f08f4..67bf8cd0 100644 --- a/server/inventory/internal/handler/supplementhandler.go +++ b/server/inventory/internal/handler/supplementhandler.go @@ -28,7 +28,7 @@ func SupplementHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.Supplement(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/inventory/internal/handler/takehandler.go b/server/inventory/internal/handler/takehandler.go index 96007a4e..bb1d285c 100644 --- a/server/inventory/internal/handler/takehandler.go +++ b/server/inventory/internal/handler/takehandler.go @@ -28,7 +28,7 @@ func TakeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.Take(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/map-library/internal/handler/getmaplibrarylisthandler.go b/server/map-library/internal/handler/getmaplibrarylisthandler.go index 8c6c6364..4b75d285 100644 --- a/server/map-library/internal/handler/getmaplibrarylisthandler.go +++ b/server/map-library/internal/handler/getmaplibrarylisthandler.go @@ -28,7 +28,7 @@ func GetMapLibraryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetMapLibraryList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/map-library/internal/handler/savemaplibraryhandler.go b/server/map-library/internal/handler/savemaplibraryhandler.go index caee5c8c..952b2877 100644 --- a/server/map-library/internal/handler/savemaplibraryhandler.go +++ b/server/map-library/internal/handler/savemaplibraryhandler.go @@ -28,7 +28,7 @@ func SaveMapLibraryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.SaveMapLibrary(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/orders/internal/handler/getorderdetailhandler.go b/server/orders/internal/handler/getorderdetailhandler.go index b998c5e8..8423debc 100644 --- a/server/orders/internal/handler/getorderdetailhandler.go +++ b/server/orders/internal/handler/getorderdetailhandler.go @@ -28,7 +28,7 @@ func GetOrderDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetOrderDetail(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/orders/internal/handler/getorderinvoicehandler.go b/server/orders/internal/handler/getorderinvoicehandler.go index 77f5ef61..4135c24f 100644 --- a/server/orders/internal/handler/getorderinvoicehandler.go +++ b/server/orders/internal/handler/getorderinvoicehandler.go @@ -28,7 +28,7 @@ func GetOrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetOrderInvoice(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-model/internal/handler/getmodeldetailhandler.go b/server/product-model/internal/handler/getmodeldetailhandler.go index 7b2ea338..36af4891 100644 --- a/server/product-model/internal/handler/getmodeldetailhandler.go +++ b/server/product-model/internal/handler/getmodeldetailhandler.go @@ -27,7 +27,7 @@ func GetModelDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetModelDetail(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-model/internal/handler/getmodelotherinfohandler.go b/server/product-model/internal/handler/getmodelotherinfohandler.go index 87e6d308..35b6c80a 100644 --- a/server/product-model/internal/handler/getmodelotherinfohandler.go +++ b/server/product-model/internal/handler/getmodelotherinfohandler.go @@ -27,7 +27,7 @@ func GetModelOtherInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetModelOtherInfo(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-model/internal/handler/updateproductmodelhandler.go b/server/product-model/internal/handler/updateproductmodelhandler.go index cf105bda..14376d63 100644 --- a/server/product-model/internal/handler/updateproductmodelhandler.go +++ b/server/product-model/internal/handler/updateproductmodelhandler.go @@ -27,7 +27,7 @@ func UpdateProductModelHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UpdateProductModel(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-template/internal/handler/addbasemaphandler.go b/server/product-template/internal/handler/addbasemaphandler.go index 1e5942c9..f9113743 100644 --- a/server/product-template/internal/handler/addbasemaphandler.go +++ b/server/product-template/internal/handler/addbasemaphandler.go @@ -27,7 +27,7 @@ func AddBaseMapHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.AddBaseMap(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-template/internal/handler/getbasemaplisthandler.go b/server/product-template/internal/handler/getbasemaplisthandler.go index 22c7296f..bf2e723b 100644 --- a/server/product-template/internal/handler/getbasemaplisthandler.go +++ b/server/product-template/internal/handler/getbasemaplisthandler.go @@ -27,7 +27,7 @@ func GetBaseMapListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetBaseMapList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-template/internal/handler/gettemplatevdetailhandler.go b/server/product-template/internal/handler/gettemplatevdetailhandler.go index e7cef6dd..80335cf8 100644 --- a/server/product-template/internal/handler/gettemplatevdetailhandler.go +++ b/server/product-template/internal/handler/gettemplatevdetailhandler.go @@ -27,7 +27,7 @@ func GetTemplatevDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetTemplatevDetail(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-template/internal/handler/savebasemaphandler.go b/server/product-template/internal/handler/savebasemaphandler.go index e3e41831..0655529b 100644 --- a/server/product-template/internal/handler/savebasemaphandler.go +++ b/server/product-template/internal/handler/savebasemaphandler.go @@ -27,7 +27,7 @@ func SaveBaseMapHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.SaveBaseMap(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product-template/internal/handler/updatetemplatehandler.go b/server/product-template/internal/handler/updatetemplatehandler.go index 3f4da440..a7ce9584 100644 --- a/server/product-template/internal/handler/updatetemplatehandler.go +++ b/server/product-template/internal/handler/updatetemplatehandler.go @@ -27,7 +27,7 @@ func UpdateTemplateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UpdateTemplate(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/designgatherhandler.go b/server/product/internal/handler/designgatherhandler.go index 516fac2f..5108a59d 100644 --- a/server/product/internal/handler/designgatherhandler.go +++ b/server/product/internal/handler/designgatherhandler.go @@ -28,7 +28,7 @@ func DesignGatherHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.DesignGather(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getfittingbypidhandler.go b/server/product/internal/handler/getfittingbypidhandler.go index adbd78ff..8c48642c 100644 --- a/server/product/internal/handler/getfittingbypidhandler.go +++ b/server/product/internal/handler/getfittingbypidhandler.go @@ -28,7 +28,7 @@ func GetFittingByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetFittingByPid(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getlastproductdesignhandler.go b/server/product/internal/handler/getlastproductdesignhandler.go index 79c32f1a..e2f656a8 100644 --- a/server/product/internal/handler/getlastproductdesignhandler.go +++ b/server/product/internal/handler/getlastproductdesignhandler.go @@ -28,7 +28,7 @@ func GetLastProductDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetLastProductDesign(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getlightbypidhandler.go b/server/product/internal/handler/getlightbypidhandler.go index 9184c2ba..2763fabd 100644 --- a/server/product/internal/handler/getlightbypidhandler.go +++ b/server/product/internal/handler/getlightbypidhandler.go @@ -28,7 +28,7 @@ func GetLightByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetLightByPid(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getmodelbypidhandler.go b/server/product/internal/handler/getmodelbypidhandler.go index ab97af0f..8457bd0c 100644 --- a/server/product/internal/handler/getmodelbypidhandler.go +++ b/server/product/internal/handler/getmodelbypidhandler.go @@ -28,7 +28,7 @@ func GetModelByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetModelByPid(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getpricebypidhandler.go b/server/product/internal/handler/getpricebypidhandler.go index f98054ac..254799fe 100644 --- a/server/product/internal/handler/getpricebypidhandler.go +++ b/server/product/internal/handler/getpricebypidhandler.go @@ -28,7 +28,7 @@ func GetPriceByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetPriceByPid(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getproductdesignhandler.go b/server/product/internal/handler/getproductdesignhandler.go index 02fef73d..42862fb8 100644 --- a/server/product/internal/handler/getproductdesignhandler.go +++ b/server/product/internal/handler/getproductdesignhandler.go @@ -28,7 +28,7 @@ func GetProductDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetProductDesign(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getproductinfohandler.go b/server/product/internal/handler/getproductinfohandler.go index 7d01c0ee..e195b2c1 100644 --- a/server/product/internal/handler/getproductinfohandler.go +++ b/server/product/internal/handler/getproductinfohandler.go @@ -28,7 +28,7 @@ func GetProductInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetProductInfo(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getproductlisthandler.go b/server/product/internal/handler/getproductlisthandler.go index a71fefc7..41360ef6 100644 --- a/server/product/internal/handler/getproductlisthandler.go +++ b/server/product/internal/handler/getproductlisthandler.go @@ -28,7 +28,7 @@ func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetProductList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getrecommandproductlisthandler.go b/server/product/internal/handler/getrecommandproductlisthandler.go index 00509d37..332ece32 100644 --- a/server/product/internal/handler/getrecommandproductlisthandler.go +++ b/server/product/internal/handler/getrecommandproductlisthandler.go @@ -28,7 +28,7 @@ func GetRecommandProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc resp := l.GetRecommandProductList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getrenderdesignhandler.go b/server/product/internal/handler/getrenderdesignhandler.go index 1a7d8ebd..967f7d05 100644 --- a/server/product/internal/handler/getrenderdesignhandler.go +++ b/server/product/internal/handler/getrenderdesignhandler.go @@ -28,7 +28,7 @@ func GetRenderDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetRenderDesign(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getrendersettingbypidhandler.go b/server/product/internal/handler/getrendersettingbypidhandler.go index 818f3d07..d6802345 100644 --- a/server/product/internal/handler/getrendersettingbypidhandler.go +++ b/server/product/internal/handler/getrendersettingbypidhandler.go @@ -28,7 +28,7 @@ func GetRenderSettingByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetRenderSettingByPid(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getsizebypidhandler.go b/server/product/internal/handler/getsizebypidhandler.go index 38b9c2d8..a17f18e8 100644 --- a/server/product/internal/handler/getsizebypidhandler.go +++ b/server/product/internal/handler/getsizebypidhandler.go @@ -28,7 +28,7 @@ func GetSizeByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetSizeByPid(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getsizebyproducthandler.go b/server/product/internal/handler/getsizebyproducthandler.go index 9bc8db8b..0451933b 100644 --- a/server/product/internal/handler/getsizebyproducthandler.go +++ b/server/product/internal/handler/getsizebyproducthandler.go @@ -28,7 +28,7 @@ func GetSizeByProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetSizeByProduct(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/getsuccessrecommandhandler.go b/server/product/internal/handler/getsuccessrecommandhandler.go index b6f5055b..63bdeae3 100644 --- a/server/product/internal/handler/getsuccessrecommandhandler.go +++ b/server/product/internal/handler/getsuccessrecommandhandler.go @@ -28,7 +28,7 @@ func GetSuccessRecommandHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetSuccessRecommand(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/gettagproductlisthandler.go b/server/product/internal/handler/gettagproductlisthandler.go index 02043645..199c0f01 100644 --- a/server/product/internal/handler/gettagproductlisthandler.go +++ b/server/product/internal/handler/gettagproductlisthandler.go @@ -28,7 +28,7 @@ func GetTagProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetTagProductList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/gettemplatebypidhandler.go b/server/product/internal/handler/gettemplatebypidhandler.go index 94268c3c..9dc538ea 100644 --- a/server/product/internal/handler/gettemplatebypidhandler.go +++ b/server/product/internal/handler/gettemplatebypidhandler.go @@ -28,7 +28,7 @@ func GetTemplateByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.GetTemplateByPid(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/homepagerecommendproductlisthandler.go b/server/product/internal/handler/homepagerecommendproductlisthandler.go index 674580a3..1cad5f91 100644 --- a/server/product/internal/handler/homepagerecommendproductlisthandler.go +++ b/server/product/internal/handler/homepagerecommendproductlisthandler.go @@ -28,7 +28,7 @@ func HomePageRecommendProductListHandler(svcCtx *svc.ServiceContext) http.Handle resp := l.HomePageRecommendProductList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/otherproductlisthandler.go b/server/product/internal/handler/otherproductlisthandler.go index 43022089..e5ad758b 100644 --- a/server/product/internal/handler/otherproductlisthandler.go +++ b/server/product/internal/handler/otherproductlisthandler.go @@ -28,7 +28,7 @@ func OtherProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.OtherProductList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/product/internal/handler/savedesignhandler.go b/server/product/internal/handler/savedesignhandler.go index 79e05c9a..51249a28 100644 --- a/server/product/internal/handler/savedesignhandler.go +++ b/server/product/internal/handler/savedesignhandler.go @@ -28,7 +28,7 @@ func SaveDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.SaveDesign(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/render/internal/handler/readimageshandler.go b/server/render/internal/handler/readimageshandler.go index e387ea0f..4156ab0f 100644 --- a/server/render/internal/handler/readimageshandler.go +++ b/server/render/internal/handler/readimageshandler.go @@ -28,7 +28,7 @@ func ReadImagesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.ReadImages(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/render/internal/handler/tounityhandler.go b/server/render/internal/handler/tounityhandler.go index e3cb5d28..80191459 100644 --- a/server/render/internal/handler/tounityhandler.go +++ b/server/render/internal/handler/tounityhandler.go @@ -28,7 +28,7 @@ func ToUnityHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.ToUnity(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/render/internal/logic/readimageslogic.go b/server/render/internal/logic/readimageslogic.go index 9ab23d58..e7d36441 100644 --- a/server/render/internal/logic/readimageslogic.go +++ b/server/render/internal/logic/readimageslogic.go @@ -31,7 +31,7 @@ func NewReadImagesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ReadIm // } // 处理逻辑后 w,r 如:重定向 -// func (l *ReadImagesLogic) AfterLogic(w http.ResponseWriter, r *http.Request) { +// func (l *ReadImagesLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // } func (l *ReadImagesLogic) ReadImages(req *types.RequestReadImages, userinfo *auth.UserInfo) (resp *basic.Response) { diff --git a/server/render/internal/logic/tounitylogic.go b/server/render/internal/logic/tounitylogic.go index f9ae5f29..bacf7b98 100644 --- a/server/render/internal/logic/tounitylogic.go +++ b/server/render/internal/logic/tounitylogic.go @@ -31,7 +31,7 @@ func NewToUnityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ToUnityLo // } // 处理逻辑后 w,r 如:重定向 -// func (l *ToUnityLogic) AfterLogic(w http.ResponseWriter, r *http.Request) { +// func (l *ToUnityLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // } func (l *ToUnityLogic) ToUnity(req *types.RequestToUnity, userinfo *auth.UserInfo) (resp *basic.Response) { diff --git a/server/shopping-cart-confirmation/internal/handler/cartaddhandler.go b/server/shopping-cart-confirmation/internal/handler/cartaddhandler.go index 26c2c676..b09b01e4 100644 --- a/server/shopping-cart-confirmation/internal/handler/cartaddhandler.go +++ b/server/shopping-cart-confirmation/internal/handler/cartaddhandler.go @@ -28,7 +28,7 @@ func CartAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.CartAdd(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/shopping-cart-confirmation/internal/handler/cartdeletehandler.go b/server/shopping-cart-confirmation/internal/handler/cartdeletehandler.go index c294d394..47cc9f8a 100644 --- a/server/shopping-cart-confirmation/internal/handler/cartdeletehandler.go +++ b/server/shopping-cart-confirmation/internal/handler/cartdeletehandler.go @@ -28,7 +28,7 @@ func CartDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.CartDelete(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/shopping-cart-confirmation/internal/handler/cartlisthandler.go b/server/shopping-cart-confirmation/internal/handler/cartlisthandler.go index 7632c87a..1066bc19 100644 --- a/server/shopping-cart-confirmation/internal/handler/cartlisthandler.go +++ b/server/shopping-cart-confirmation/internal/handler/cartlisthandler.go @@ -28,7 +28,7 @@ func CartListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.CartList(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/shopping-cart-confirmation/internal/handler/cartnumberhandler.go b/server/shopping-cart-confirmation/internal/handler/cartnumberhandler.go index 5aa85d0b..4ff7632d 100644 --- a/server/shopping-cart-confirmation/internal/handler/cartnumberhandler.go +++ b/server/shopping-cart-confirmation/internal/handler/cartnumberhandler.go @@ -28,7 +28,7 @@ func CartNumberHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.CartNumber(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/shopping-cart-confirmation/internal/handler/cartorderdetailhandler.go b/server/shopping-cart-confirmation/internal/handler/cartorderdetailhandler.go index a1bb344b..94b4b738 100644 --- a/server/shopping-cart-confirmation/internal/handler/cartorderdetailhandler.go +++ b/server/shopping-cart-confirmation/internal/handler/cartorderdetailhandler.go @@ -28,7 +28,7 @@ func CartOrderDetailHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.CartOrderDetail(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/shopping-cart-confirmation/internal/handler/changeordermethodhandler.go b/server/shopping-cart-confirmation/internal/handler/changeordermethodhandler.go index ce58d809..dc8d6ec4 100644 --- a/server/shopping-cart-confirmation/internal/handler/changeordermethodhandler.go +++ b/server/shopping-cart-confirmation/internal/handler/changeordermethodhandler.go @@ -28,7 +28,7 @@ func ChangeOrderMethodHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.ChangeOrderMethod(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/shopping-cart-confirmation/internal/handler/createorderhandler.go b/server/shopping-cart-confirmation/internal/handler/createorderhandler.go index 75083e14..8ecb0f07 100644 --- a/server/shopping-cart-confirmation/internal/handler/createorderhandler.go +++ b/server/shopping-cart-confirmation/internal/handler/createorderhandler.go @@ -28,7 +28,7 @@ func CreateOrderHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.CreateOrder(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/upload/internal/handler/uploadfilefrontendhandler.go b/server/upload/internal/handler/uploadfilefrontendhandler.go index 6a0a4440..f70b1e96 100644 --- a/server/upload/internal/handler/uploadfilefrontendhandler.go +++ b/server/upload/internal/handler/uploadfilefrontendhandler.go @@ -28,7 +28,7 @@ func UploadFileFrontendHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UploadFileFrontend(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/upload/internal/handler/uploadqrcodehandler.go b/server/upload/internal/handler/uploadqrcodehandler.go index f5908197..6223728c 100644 --- a/server/upload/internal/handler/uploadqrcodehandler.go +++ b/server/upload/internal/handler/uploadqrcodehandler.go @@ -28,7 +28,7 @@ func UploadQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UploadQrcode(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/upload/internal/handler/uploadupfilehandler.go b/server/upload/internal/handler/uploadupfilehandler.go index ae41d8b9..625e7d14 100644 --- a/server/upload/internal/handler/uploadupfilehandler.go +++ b/server/upload/internal/handler/uploadupfilehandler.go @@ -28,7 +28,7 @@ func UploadUpFileHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.UploadUpFile(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/webset/internal/handler/websetsettinghandler.go b/server/webset/internal/handler/websetsettinghandler.go index 16f13892..b8b0a606 100644 --- a/server/webset/internal/handler/websetsettinghandler.go +++ b/server/webset/internal/handler/websetsettinghandler.go @@ -28,7 +28,7 @@ func WebSetSettingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { resp := l.WebSetSetting(&req, userinfo) - if !basic.AfterLogic(w, r, rl) { + if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) } } diff --git a/server/webset/internal/logic/websetsettinglogic.go b/server/webset/internal/logic/websetsettinglogic.go index 50da5798..c8fca38f 100644 --- a/server/webset/internal/logic/websetsettinglogic.go +++ b/server/webset/internal/logic/websetsettinglogic.go @@ -34,7 +34,7 @@ func NewWebSetSettingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Web // } // 处理逻辑后 w,r 如:重定向 -// func (l *WebSetSettingLogic) AfterLogic(w http.ResponseWriter, r *http.Request) { +// func (l *WebSetSettingLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // } func (l *WebSetSettingLogic) WebSetSetting(req *types.RequestWebSet, userinfo *auth.UserInfo) (resp *basic.Response) { diff --git a/utils/basic/request_parse.go b/utils/basic/request_parse.go index 54504d6b..e1eddff7 100644 --- a/utils/basic/request_parse.go +++ b/utils/basic/request_parse.go @@ -27,11 +27,11 @@ func BeforeLogic(w http.ResponseWriter, r *http.Request, l reflect.Value) (isNex return true } -func AfterLogic(w http.ResponseWriter, r *http.Request, l reflect.Value) bool { +func AfterLogic(w http.ResponseWriter, r *http.Request, l reflect.Value, resp *Response) bool { m := l.MethodByName("AfterLogic") if m.IsValid() { - m.Call([]reflect.Value{reflect.ValueOf(w), reflect.ValueOf(r)}) + m.Call([]reflect.Value{reflect.ValueOf(w), reflect.ValueOf(r), reflect.ValueOf(resp)}) return true } return false