From ae58b41ac64039a7f1d4d8dc9076f31053ed57d5 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 31 Oct 2019 14:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E7=9B=9F=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/cs/weimob_order.go | 4 ++++ controllers/weimob_callback.go | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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 {