This commit is contained in:
邹宗楠
2024-03-04 10:50:52 +08:00
parent 3aabfb9ac1
commit efacc81f0a
2 changed files with 19 additions and 2 deletions

View File

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

View File

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