- 新增OrderStatusUndoApplyCancel
This commit is contained in:
@@ -25,6 +25,7 @@ const (
|
||||
callDeliveryDelayGap = 30
|
||||
|
||||
fakeUserApplyCancel = "fake_user_apply_cancel"
|
||||
fakeUserUndoApplyCancel = "fake_user_undo_apply_cancel"
|
||||
fakeAcceptOrder = "fake_accept_order"
|
||||
fakeOrderAdjustFinished = "fake_order_adjust_finished"
|
||||
)
|
||||
@@ -43,6 +44,7 @@ var (
|
||||
|
||||
fakeOrderAdjustFinished: model.OrderStatusAdjust,
|
||||
fakeUserApplyCancel: model.OrderStatusApplyCancel,
|
||||
fakeUserUndoApplyCancel: model.OrderStatusUndoApplyCancel,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -262,30 +264,31 @@ func (c *PurchaseHandler) callbackMsg2Status(msg *ebaiapi.CallbackMsg) (orderSta
|
||||
RefVendorOrderID: orderID,
|
||||
RefVendorID: model.VendorIDEBAI,
|
||||
StatusTime: utils.Timestamp2Time(msg.Timestamp),
|
||||
VendorStatus: msg.Cmd,
|
||||
}
|
||||
if msg.Cmd == ebaiapi.CmdOrderUserCancel {
|
||||
msgType := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["type"]))
|
||||
cancelType := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["cancel_type"]))
|
||||
if msgType == ebaiapi.OrderUserCancelApply && cancelType == ebaiapi.OrderUserCancelTypeBeforeSale {
|
||||
orderStatus.VendorStatus = fakeUserApplyCancel
|
||||
orderStatus.Remark = utils.Interface2String(msg.Body["cancel_reason"])
|
||||
if additionReason := utils.Interface2String(msg.Body["addition_reason"]); additionReason != "" {
|
||||
orderStatus.Remark += ",额外原因:" + additionReason
|
||||
orderStatus.Remark = utils.Interface2String(msg.Body["cancel_reason"])
|
||||
if additionReason := utils.Interface2String(msg.Body["addition_reason"]); additionReason != "" {
|
||||
orderStatus.Remark += ",额外原因:" + additionReason
|
||||
}
|
||||
if cancelType == ebaiapi.OrderUserCancelTypeBeforeSale {
|
||||
if msgType == ebaiapi.OrderUserCancelApply {
|
||||
orderStatus.VendorStatus = fakeUserApplyCancel
|
||||
} else if msgType == ebaiapi.OrderUserCancelInvalid {
|
||||
orderStatus.VendorStatus = fakeUserUndoApplyCancel
|
||||
}
|
||||
} else {
|
||||
orderStatus = nil
|
||||
}
|
||||
} else if msg.Cmd == ebaiapi.CmdOrderPartRefund {
|
||||
msgType := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["type"]))
|
||||
status := utils.Int64ToStr(utils.MustInterface2Int64(msg.Body["status"]))
|
||||
orderStatus.Remark = utils.Interface2String(msg.Body["reason"])
|
||||
if additionReason := utils.Interface2String(msg.Body["addition_reason"]); additionReason != "" {
|
||||
orderStatus.Remark += ",额外原因:" + additionReason
|
||||
}
|
||||
if msgType == ebaiapi.OrderPartRefuncTypeMerchant && status == ebaiapi.OrderPartRefundSuccess {
|
||||
orderStatus.VendorStatus = fakeOrderAdjustFinished
|
||||
orderStatus.Remark = utils.Interface2String(msg.Body["reason"])
|
||||
if additionReason := utils.Interface2String(msg.Body["addition_reason"]); additionReason != "" {
|
||||
orderStatus.Remark += ",额外原因:" + additionReason
|
||||
}
|
||||
} else {
|
||||
orderStatus = nil
|
||||
}
|
||||
} else if status, ok := msg.Body["status"]; ok {
|
||||
if vendorStatus, ok := status.(string); ok {
|
||||
@@ -294,13 +297,8 @@ func (c *PurchaseHandler) callbackMsg2Status(msg *ebaiapi.CallbackMsg) (orderSta
|
||||
orderStatus.VendorStatus = utils.Int64ToStr(utils.MustInterface2Int64(status))
|
||||
}
|
||||
orderStatus.Remark = utils.Interface2String(msg.Body["reason"])
|
||||
} else {
|
||||
orderStatus = nil
|
||||
globals.SugarLogger.Infof("ebai callbackMsg2Status can not find status field in msg:%s", utils.Format4Output(msg, false))
|
||||
}
|
||||
if orderStatus != nil {
|
||||
orderStatus.Status = c.GetStatusFromVendorStatus(orderStatus.VendorStatus)
|
||||
}
|
||||
orderStatus.Status = c.GetStatusFromVendorStatus(orderStatus.VendorStatus)
|
||||
return orderStatus
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user