From efacc81f0a7a8b3b70c803c09bf5fbf39264df05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 4 Mar 2024 10:50:52 +0800 Subject: [PATCH] 1 --- business/jxcallback/orderman/order.go | 17 +++++++++++++++++ business/partner/purchase/mtwm/order_afs.go | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 1b7ba5bae..aa8c24ad6 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -4,9 +4,12 @@ import ( "crypto/md5" "errors" "fmt" + "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/platformapi/tao_vegetable" "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api" + "git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm" "math" + "strconv" "strings" "time" @@ -273,6 +276,20 @@ func (c *OrderManager) OnOrderStatusChanged(vendorOrgCode string, orderStatus *m order2.OrderFinishedAt = time.Now() dao.UpdateEntity(db, order2, "OrderFinishedAt") } + if orderStatus.Status == model.OrderStatusCanceled && orderStatus.VendorID == model.VendorIDMTWM { + num, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", utils.Int64ToFloat64(order.TotalShopMoney)/float64(100)), 64) + applyErr := mtwm.GetAPI(order.VendorOrgCode, order.StoreID, order.VendorStoreID).ApplyCompensation(&mtwmapi.ApplyCompensationRes{ + OrderId: utils.Str2Int64(order.VendorOrderID), + Reason: "商户申请", + ApplyStatus: mtwmapi.ApplyCompensationStatusOne, + Amount: num, + }) + if applyErr != nil { + partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(order.Status), fmt.Sprintf("取消订单申请赔付失败:%s", applyErr.Error())) + } else { + partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(order.Status), fmt.Sprintf("取消订单申请赔付:%s", "成功")) + } + } // 判断是否需要打印取消订单 storeDetail, errDetail := c.LoadStoreDetail(order2.JxStoreID, order2.VendorID) diff --git a/business/partner/purchase/mtwm/order_afs.go b/business/partner/purchase/mtwm/order_afs.go index ed39bb0bc..456825dbb 100644 --- a/business/partner/purchase/mtwm/order_afs.go +++ b/business/partner/purchase/mtwm/order_afs.go @@ -202,9 +202,9 @@ func (c *PurchaseHandler) onAfsOrderMsg(msg *mtwmapi.CallbackMsg) (retVal *mtwma Amount: num, }) if applyErr != nil { - partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(order.Status), fmt.Sprintf("取消订单申请赔付失败:%s", applyErr.Error())) + partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(order.Status), fmt.Sprintf("售后取消订单申请赔付失败:%s", applyErr.Error())) } else { - partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(order.Status), fmt.Sprintf("取消订单申请赔付:%s", "成功")) + partner.CurOrderManager.OnOrderMsg(order, utils.Int2Str(order.Status), fmt.Sprintf("售后取消订单申请赔付:%s", "成功")) } }