- 调整售后单消息的处理次序

- 将test配置改为dev一致,本地测试可用beta
This commit is contained in:
gazebo
2019-05-11 13:16:29 +08:00
parent 90a4f4973f
commit aa4e9c3507
9 changed files with 45 additions and 68 deletions

View File

@@ -61,7 +61,7 @@ func (p *PurchaseHandler) OrderFinancialDetail2Refund(orderFinancial *model.Orde
VendorID: model.VendorIDEBAI,
AfsOrderID: GetOrderIDFromMsg(msg),
VendorOrderID: GetOrderIDFromMsg(msg),
AfsCreateAt: utils.Timestamp2Time(msg.Timestamp),
AfsCreatedAt: utils.Timestamp2Time(msg.Timestamp),
// BoxMoney: orderFinancial.BoxMoney, // 饿百的餐盒费已经拆分到单条Sku里面退款时直接计算用户支付sku金额就好了
// SkuBoxMoney: orderFinancial.SkuBoxMoney,
FreightUserMoney: orderFinancial.FreightMoney,
@@ -157,7 +157,7 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac
afsOrder.PmSubsidyMoney += orderSkuFinancial.PmSubsidyMoney
}
if len(refundDetail) > 0 {
afsOrder.AfsCreateAt = getTimeFromInterface(refundDetail[0].(map[string]interface{})["apply_time"])
afsOrder.AfsCreatedAt = getTimeFromInterface(refundDetail[0].(map[string]interface{})["apply_time"])
} else {
globals.SugarLogger.Warnf("ebai AfsOrderDetail2Financial, orderID:%s have no refund_detail", afsOrder.VendorOrderID)
}

View File

@@ -6,6 +6,7 @@ import (
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/partner"
@@ -44,9 +45,11 @@ func (c *PurchaseHandler) isAfsMsg(msg *ebaiapi.CallbackMsg) bool {
}
func (c *PurchaseHandler) OnAfsOrderMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaiapi.CallbackResponse) {
utils.CallFuncAsync(func() {
retVal = c.onAfsOrderMsg(msg)
})
jxutils.CallMsgHandler(func() {
utils.CallFuncAsync(func() {
retVal = c.onAfsOrderMsg(msg)
})
}, jxutils.ComposeUniversalOrderID(GetOrderIDFromMsg(msg), model.VendorIDEBAI))
return retVal
}
@@ -58,7 +61,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaia
VendorOrderID: orderStatus.RefVendorOrderID,
VendorStoreID: "",
StoreID: 0,
AfsCreateAt: utils.Timestamp2Time(msg.Timestamp),
AfsCreatedAt: utils.Timestamp2Time(msg.Timestamp),
VendorAppealType: "",
AppealType: model.AfsAppealTypeRefund,
// FreightUserMoney: afsInfo.OrderFreightMoney,

View File

@@ -177,7 +177,7 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData map[string]interfac
VendorOrderID: utils.Interface2String(orderData["orderId"]),
VendorStoreID: utils.Interface2String(orderData["stationId"]),
StoreID: int(utils.Str2Int64WithDefault(utils.Interface2String(orderData["stationNumOutSystem"]), 0)),
AfsCreateAt: utils.Timestamp2Time(utils.MustInterface2Int64(orderData["updateTime"].(map[string]interface{})["time"]) / 1000),
AfsCreatedAt: utils.Timestamp2Time(utils.MustInterface2Int64(orderData["updateTime"].(map[string]interface{})["time"]) / 1000),
FreightUserMoney: utils.MustInterface2Int64(orderData["orderFreightMoney"]),
AfsFreightMoney: utils.MustInterface2Int64(orderData["afsFreight"]),
BoxMoney: utils.MustInterface2Int64(orderData["packagingMoney"]),

View File

@@ -12,6 +12,6 @@ func TestOnFinancialMsg(t *testing.T) {
BillID: "907315020000322",
StatusID: "330902",
}
res := OnFinancialMsg(msg)
res := curPurchaseHandler.onFinancialMsg(msg)
fmt.Println(res)
}

View File

@@ -3,6 +3,7 @@ package jd
import (
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/partner"
@@ -60,7 +61,9 @@ var (
func (c *PurchaseHandler) OnAfsOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
utils.CallFuncAsync(func() {
retVal = c.onAfsOrderMsg(msg)
jxutils.CallMsgHandler(func() {
retVal = c.onAfsOrderMsg(msg)
}, jxutils.ComposeUniversalOrderID(msg.BillID, model.VendorIDJD))
})
return retVal
}
@@ -125,7 +128,7 @@ func (c *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsO
VendorOrderID: afsInfo.OrderID,
VendorStoreID: afsInfo.StationID,
StoreID: int(utils.Str2Int64WithDefault(afsInfo.StationNumOutSystem, 0)),
AfsCreateAt: afsInfo.UpdateTime.GoTime(),
AfsCreatedAt: afsInfo.UpdateTime.GoTime(),
FreightUserMoney: afsInfo.OrderFreightMoney,
AfsFreightMoney: afsInfo.AfsFreight,
BoxMoney: afsInfo.PackagingMoney,

View File

@@ -45,7 +45,7 @@ func (p *PurchaseHandler) OrderFinancialDetail2Refund(orderFinancial *model.Orde
VendorID: model.VendorIDMTWM,
AfsOrderID: orderData.Get("order_id"),
VendorOrderID: orderData.Get("order_id"),
AfsCreateAt: utils.Timestamp2Time(utils.Str2Int64(orderData.Get("timestamp"))),
AfsCreatedAt: utils.Timestamp2Time(utils.Str2Int64(orderData.Get("timestamp"))),
// BoxMoney: orderFinancial.BoxMoney,
// SkuBoxMoney: orderFinancial.SkuBoxMoney, // 美团的餐盒费已经拆到单条SKU里面去了,退款时直接计算用户支付sku金额就好了
FreightUserMoney: orderFinancial.FreightMoney,
@@ -93,7 +93,7 @@ func (p *PurchaseHandler) AfsOrderDetail2Financial(orderData url.Values) (afsOrd
VendorID: model.VendorIDMTWM,
AfsOrderID: orderData.Get("order_id"),
VendorOrderID: orderData.Get("order_id"),
AfsCreateAt: utils.Timestamp2Time(utils.Str2Int64(orderData.Get("timestamp"))),
AfsCreatedAt: utils.Timestamp2Time(utils.Str2Int64(orderData.Get("timestamp"))),
RefundMoney: jxutils.StandardPrice2Int(utils.Str2Float64(orderData.Get("money"))),
}
// if orderData.Get("timestamp") != "" {