将美团和饿百取消订单申请索赔整合到interface中
This commit is contained in:
@@ -4,13 +4,10 @@ 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/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -281,18 +278,16 @@ 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(order2.TotalShopMoney)/float64(100)), 64)
|
||||
applyErr := mtwm.GetAPI(order2.VendorOrgCode, order2.StoreID, order2.VendorStoreID).ApplyCompensation(&mtwmapi.ApplyCompensationRes{
|
||||
OrderId: utils.Str2Int64(order2.VendorOrderID),
|
||||
Reason: "商户申请",
|
||||
ApplyStatus: mtwmapi.ApplyCompensationStatusOne,
|
||||
Amount: num,
|
||||
})
|
||||
|
||||
if handler := partner.GetPurchaseOrderHandlerFromVendorID(orderStatus.VendorID); handler != nil && (orderStatus.VendorID == model.VendorIDMTWM || orderStatus.VendorID == model.VendorIDEBAI) {
|
||||
compensation, applyErr := handler.ApplyCompensationOrder(order2)
|
||||
if applyErr != nil {
|
||||
partner.CurOrderManager.OnOrderMsg(order2, utils.Int2Str(order2.Status), fmt.Sprintf("取消订单申请赔付失败:%s", applyErr.Error()))
|
||||
} else {
|
||||
partner.CurOrderManager.OnOrderMsg(order2, utils.Int2Str(order2.Status), fmt.Sprintf("取消订单申请赔付:%s", "成功"))
|
||||
if compensation == "" {
|
||||
compensation = "成功"
|
||||
}
|
||||
partner.CurOrderManager.OnOrderMsg(order2, utils.Int2Str(order2.Status), fmt.Sprintf("取消订单申请赔付:%s", compensation))
|
||||
}
|
||||
|
||||
if order2.Status != model.OrderStatusCanceled {
|
||||
|
||||
Reference in New Issue
Block a user