diff --git a/business/cs/weimob_order.go b/business/cs/weimob_order.go index e5d89e979..8d088336b 100644 --- a/business/cs/weimob_order.go +++ b/business/cs/weimob_order.go @@ -26,11 +26,14 @@ func OnCallbackMsg(msg *weimobapi.CallbackMsg) (response *weimobapi.CallbackResp } func onOrderMsg(msg *weimobapi.CallbackMsg) (response *weimobapi.CallbackResponse) { + globals.SugarLogger.Debugf("onOrderMsg:%s", utils.Format4Output(msg, true)) if msg.Event == weimobapi.MsgEventOrderStatusChange { if orderDetail, err := api.WeimobAPI.QueryOrderDetail2(msg.OrderNo, false); err == nil { if orderDetail.OrderStatus == weimobapi.OrderStatusFinished && orderDetail.PaymentAmount >= minCSOrderPayment { changeStoreSkusByOrder(orderDetail) } + } else { + response = weimobapi.Err2CallbackResponse(err, "") } } return response @@ -43,6 +46,7 @@ func changeStoreSkusByOrder(order *weimobapi.OrderDetail) { if len(storeList) == 1 { var skuBindInfos []*cms.StoreSkuBindInfo storeID := storeList[0].ID + globals.SugarLogger.Debugf("changeStoreSkusByOrder storeID:%d", storeID) for _, v := range order.ItemList { nameID := int(utils.Str2Int64WithDefault(v.SkuCode, 0)) unitPrice := v.OriginalPrice diff --git a/controllers/weimob_callback.go b/controllers/weimob_callback.go index 7989ae264..ff3c8b5b5 100644 --- a/controllers/weimob_callback.go +++ b/controllers/weimob_callback.go @@ -2,8 +2,8 @@ package controllers import ( "git.rosy.net.cn/baseapi/platformapi/weimobapi" - "git.rosy.net.cn/jx-callback/business/jxutils/tasks" "git.rosy.net.cn/jx-callback/business/cs" + "git.rosy.net.cn/jx-callback/business/jxutils/tasks" "git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals/api" "github.com/astaxie/beego" @@ -15,12 +15,14 @@ type WeimobController struct { func (c *WeimobController) onCallbackMsg() { if true { //c.Ctx.Input.Method() == http.MethodPost { - callbackResponse := weimobapi.SuccessResponse msg, callbackResponse := api.WeimobAPI.GetCallbackMsg(c.Ctx.Input.RequestBody) if callbackResponse == nil { // callbackResponse = wsc.OnCallbackMsg(msg) callbackResponse = cs.OnCallbackMsg(msg) } + if callbackResponse == nil { + callbackResponse = weimobapi.SuccessResponse + } c.Data["json"] = callbackResponse c.ServeJSON() } else {