- 输出京东回调的返回结果
This commit is contained in:
@@ -34,7 +34,7 @@ func (c *DjswController) orderStatus(isCancelOrder bool) {
|
|||||||
if callbackResponse == nil {
|
if callbackResponse == nil {
|
||||||
callbackResponse = jd.OnOrderMsg(obj)
|
callbackResponse = jd.OnOrderMsg(obj)
|
||||||
}
|
}
|
||||||
c.Data["json"] = c.transferResponse(callbackResponse)
|
c.Data["json"] = c.transferResponse("orderStatus", callbackResponse)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
c.Abort("404")
|
c.Abort("404")
|
||||||
@@ -87,7 +87,7 @@ func (c *DjswController) PushDeliveryStatus() {
|
|||||||
if callbackResponse == nil {
|
if callbackResponse == nil {
|
||||||
callbackResponse = jd.OnWaybillMsg(obj)
|
callbackResponse = jd.OnWaybillMsg(obj)
|
||||||
}
|
}
|
||||||
c.Data["json"] = c.transferResponse(callbackResponse)
|
c.Data["json"] = c.transferResponse("PushDeliveryStatus", callbackResponse)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
c.Abort("404")
|
c.Abort("404")
|
||||||
@@ -103,7 +103,7 @@ func (c *DjswController) Token() {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false))
|
globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false))
|
||||||
}
|
}
|
||||||
c.Data["json"] = c.transferResponse(nil)
|
c.Data["json"] = c.transferResponse("Token", nil)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ func (c *DjswController) StockIsHave() {
|
|||||||
// globals.SugarLogger.Debugf("StockIsHave, obj:%s", utils.Format4Output(obj, false))
|
// globals.SugarLogger.Debugf("StockIsHave, obj:%s", utils.Format4Output(obj, false))
|
||||||
callbackResponse = promotion.OnStoreStockMsg(obj)
|
callbackResponse = promotion.OnStoreStockMsg(obj)
|
||||||
}
|
}
|
||||||
c.Data["json"] = c.transferResponse(callbackResponse)
|
c.Data["json"] = c.transferResponse("StockIsHave", callbackResponse)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
c.Abort("404")
|
c.Abort("404")
|
||||||
@@ -128,7 +128,7 @@ func (c *DjswController) SinglePromoteCreate() {
|
|||||||
if callbackResponse == nil {
|
if callbackResponse == nil {
|
||||||
callbackResponse = promotion.OnNewPromotionMsg(obj)
|
callbackResponse = promotion.OnNewPromotionMsg(obj)
|
||||||
}
|
}
|
||||||
c.Data["json"] = c.transferResponse(callbackResponse)
|
c.Data["json"] = c.transferResponse("SinglePromoteCreate", callbackResponse)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
c.Abort("404")
|
c.Abort("404")
|
||||||
@@ -141,20 +141,21 @@ func (c *DjswController) StoreCrud() {
|
|||||||
if callbackResponse == nil {
|
if callbackResponse == nil {
|
||||||
callbackResponse = jd.OnStoreMsg(obj)
|
callbackResponse = jd.OnStoreMsg(obj)
|
||||||
}
|
}
|
||||||
c.Data["json"] = c.transferResponse(callbackResponse)
|
c.Data["json"] = c.transferResponse("StoreCrud", callbackResponse)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
} else {
|
} else {
|
||||||
c.Abort("404")
|
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() {
|
if globals.IsCallbackAlwaysReturnSuccess() {
|
||||||
return jdapi.SuccessResponse
|
return jdapi.SuccessResponse
|
||||||
}
|
}
|
||||||
if inCallbackResponse == nil {
|
if inCallbackResponse == nil {
|
||||||
return jdapi.SuccessResponse
|
return jdapi.SuccessResponse
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("%s callbackResponse:%s", funcName, utils.Format4Output(inCallbackResponse, true))
|
||||||
return inCallbackResponse
|
return inCallbackResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,6 +197,6 @@ func getUsefulRequest(ctx *context.Context) *http.Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *DjswController) nullOperation() {
|
func (c *DjswController) nullOperation() {
|
||||||
c.Data["json"] = c.transferResponse(nil)
|
c.Data["json"] = c.transferResponse("nullOperation", nil)
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user