diff --git a/controllers/jd_callback.go b/controllers/jd_callback.go index 59273061e..eb47f2f4e 100644 --- a/controllers/jd_callback.go +++ b/controllers/jd_callback.go @@ -34,7 +34,7 @@ func (c *DjswController) orderStatus(isCancelOrder bool) { if callbackResponse == nil { callbackResponse = jd.OnOrderMsg(obj) } - c.Data["json"] = c.transferResponse(callbackResponse) + c.Data["json"] = c.transferResponse("orderStatus", callbackResponse) c.ServeJSON() } else { c.Abort("404") @@ -87,7 +87,7 @@ func (c *DjswController) PushDeliveryStatus() { if callbackResponse == nil { callbackResponse = jd.OnWaybillMsg(obj) } - c.Data["json"] = c.transferResponse(callbackResponse) + c.Data["json"] = c.transferResponse("PushDeliveryStatus", callbackResponse) c.ServeJSON() } else { c.Abort("404") @@ -103,7 +103,7 @@ func (c *DjswController) Token() { if err == nil { globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false)) } - c.Data["json"] = c.transferResponse(nil) + c.Data["json"] = c.transferResponse("Token", nil) c.ServeJSON() } @@ -115,7 +115,7 @@ func (c *DjswController) StockIsHave() { // globals.SugarLogger.Debugf("StockIsHave, obj:%s", utils.Format4Output(obj, false)) callbackResponse = promotion.OnStoreStockMsg(obj) } - c.Data["json"] = c.transferResponse(callbackResponse) + c.Data["json"] = c.transferResponse("StockIsHave", callbackResponse) c.ServeJSON() } else { c.Abort("404") @@ -128,7 +128,7 @@ func (c *DjswController) SinglePromoteCreate() { if callbackResponse == nil { callbackResponse = promotion.OnNewPromotionMsg(obj) } - c.Data["json"] = c.transferResponse(callbackResponse) + c.Data["json"] = c.transferResponse("SinglePromoteCreate", callbackResponse) c.ServeJSON() } else { c.Abort("404") @@ -141,20 +141,21 @@ func (c *DjswController) StoreCrud() { if callbackResponse == nil { callbackResponse = jd.OnStoreMsg(obj) } - c.Data["json"] = c.transferResponse(callbackResponse) + c.Data["json"] = c.transferResponse("StoreCrud", callbackResponse) c.ServeJSON() } else { c.Abort("404") } } -func (c *DjswController) transferResponse(inCallbackResponse *jdapi.CallbackResponse) (outCallbackResponse *jdapi.CallbackResponse) { +func (c *DjswController) transferResponse(funcName string, inCallbackResponse *jdapi.CallbackResponse) (outCallbackResponse *jdapi.CallbackResponse) { if globals.IsCallbackAlwaysReturnSuccess() { return jdapi.SuccessResponse } if inCallbackResponse == nil { return jdapi.SuccessResponse } + globals.SugarLogger.Debugf("%s callbackResponse:%s", funcName, utils.Format4Output(inCallbackResponse, true)) return inCallbackResponse } @@ -196,6 +197,6 @@ func getUsefulRequest(ctx *context.Context) *http.Request { } func (c *DjswController) nullOperation() { - c.Data["json"] = c.transferResponse(nil) + c.Data["json"] = c.transferResponse("nullOperation", nil) c.ServeJSON() }