重新调整w,r的入口
This commit is contained in:
parent
4c2f823178
commit
7ec78d1c35
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(`
|
||||
<!DOCTYPE html>
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user