- OnNewPromotionMsg

This commit is contained in:
gazebo
2018-11-08 11:27:31 +08:00
parent 1fd2305269
commit 11f8ba1ecd
2 changed files with 18 additions and 3 deletions

View File

@@ -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)
}

View File

@@ -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")
}
}