This commit is contained in:
邹宗楠
2024-06-06 15:51:18 +08:00
parent 0457f2ee5b
commit a1983813fc
2 changed files with 3 additions and 20 deletions

View File

@@ -200,9 +200,6 @@ func (c *OrderManager) addAfsOrderStatus(db *dao.DaoDB, orderStatus *model.Order
if db == nil {
db = dao.GetDB()
}
if orderStatus.RefVendorOrderID == "3801105140856800486" {
globals.SugarLogger.Debugf("======orderStatus := %s", utils.Format4Output(orderStatus, false))
}
isDuplicated, err = addOrderOrWaybillStatus(orderStatus, db)
//if err == nil && !isDuplicated && (orderStatus.Status != model.OrderStatusUnknown && orderStatus.Status != model.OrderStatusMsg) {
if err == nil && (orderStatus.Status != model.OrderStatusUnknown && orderStatus.Status != model.OrderStatusMsg) {
@@ -211,9 +208,6 @@ func (c *OrderManager) addAfsOrderStatus(db *dao.DaoDB, orderStatus *model.Order
VendorID: orderStatus.VendorID,
}
if err = db.Db.ReadForUpdate(order, "AfsOrderID", "VendorID"); err == nil {
if orderStatus.RefVendorOrderID == "3801105140856800486" {
globals.SugarLogger.Debugf("======order := %s", utils.Format4Output(order, false))
}
if orderStatus.Status > model.OrderStatusUnknown { // todo 要求status不能回绕
order.VendorStatus = orderStatus.VendorStatus
order.Status = orderStatus.Status
@@ -236,14 +230,8 @@ func (c *OrderManager) addAfsOrderStatus(db *dao.DaoDB, orderStatus *model.Order
updateFields = append(updateFields, "AfsFinishedAt")
if handler := partner.GetPurchaseOrderHandlerFromVendorID(order.VendorID); handler != nil {
if orderAfsInfo, err := handler.GetOrderAfsInfo(nil, order.VendorOrderID, order.AfsOrderID); err == nil && orderAfsInfo.AfsTotalShopMoney != 0 {
if orderStatus.RefVendorOrderID == "3801105140856800486" {
globals.SugarLogger.Debugf("======orderAfsInfo := %s", utils.Format4Output(orderAfsInfo, false))
}
order.AfsTotalShopMoney = orderAfsInfo.AfsTotalShopMoney
updateFields = append(updateFields, "AfsTotalShopMoney")
if orderStatus.RefVendorOrderID == "3801105140856800486" {
globals.SugarLogger.Debugf("======order2 := %s", utils.Format4Output(order, false))
}
}
}
}

View File

@@ -3,6 +3,7 @@ package mtwm
import (
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/globals/api"
"net/url"
"strconv"
"strings"
@@ -308,20 +309,14 @@ func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.G
func (c *PurchaseHandler) GetOrderAfsInfo(ctx *jxcontext.Context, vendorOrderID, afsOrderID string) (orderAfsInfo *partner.OrderAfsInfo, err error) {
orderAfsInfo = &partner.OrderAfsInfo{}
var afsTotalShopMoney int64
order, _ := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDMTWM)
list, err := getAPI(order.VendorOrgCode, jxutils.GetShowStoreIDFromOrder(order), order.VendorStoreID).GetOrderRefundDetail(utils.Str2Int64(vendorOrderID), 0)
globals.SugarLogger.Debugf("=================list-v := %s", utils.Format4Output(list, false))
globals.SugarLogger.Debugf("=================list-v err:= %v", utils.Format4Output(list, false))
if err == nil {
if list, err := api.MtwmAPI.GetOrderRefundDetail(utils.Str2Int64(vendorOrderID), 0); err == nil {
for _, v := range list {
if v.RefundPartialEstimateCharge.SettleAmount != "" {
afsTotalShopMoney += jxutils.StandardPrice2Int(utils.Str2Float64(v.RefundPartialEstimateCharge.SettleAmount))
}
}
}
if err == nil {
if order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDMTWM); err == nil {
orderAfsInfo.AfsTotalShopMoney = order.TotalShopMoney + afsTotalShopMoney
}
return orderAfsInfo, err