diff --git a/business/jxstore/promotion/jd_promotion.go b/business/jxstore/promotion/jd_promotion.go index 3eb31f4de..04abef783 100644 --- a/business/jxstore/promotion/jd_promotion.go +++ b/business/jxstore/promotion/jd_promotion.go @@ -872,6 +872,14 @@ func OnStoreStockMsg(msg *jdapi.CallbackStoreStockMsg) (retVal *jdapi.CallbackRe return jdapi.Err2CallbackResponse(err, "") } +func OnNewPromotionMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) { + result, err := api.JdAPI.QueryPromotionInfo(utils.Str2Int64(msg.BillID)) + if err == nil { + globals.SugarLogger.Debug(utils.Format4Output(result, false)) + } + return jdapi.Err2CallbackResponse(err, "") +} + func excelStr2Time(timeStr string) (tm time.Time, err error) { return time.ParseInLocation("2006年1月2日15点4分5秒", timeStr, time.Local) } diff --git a/controllers/jd_callback.go b/controllers/jd_callback.go index 55eb82d38..6fc36fe85 100644 --- a/controllers/jd_callback.go +++ b/controllers/jd_callback.go @@ -116,7 +116,14 @@ func (c *DjswController) StockIsHave() { } func (c *DjswController) SinglePromoteCreate() { - globals.SugarLogger.Info(string(c.Ctx.Input.RequestBody)) - c.Data["json"] = jdapi.Err2CallbackResponse(nil, "") - c.ServeJSON() + if c.Ctx.Input.Method() == http.MethodPost { + obj, callbackResponse := api.JdAPI.GetOrderCallbackMsg(c.Ctx.Input.RequestBody) + if callbackResponse == nil { + callbackResponse = promotion.OnNewPromotionMsg(obj) + } + c.Data["json"] = callbackResponse + c.ServeJSON() + } else { + c.Abort("404") + } }