京东售后单消息全处理(可能有重复)

This commit is contained in:
gazebo
2020-01-20 13:48:20 +08:00
parent 1aa808aae5
commit 02e9e61295
3 changed files with 34 additions and 24 deletions

View File

@@ -46,6 +46,13 @@ var (
} }
selfTakeCodeReg = regexp.MustCompile(`等待用户凭提货码(\d+)于`) selfTakeCodeReg = regexp.MustCompile(`等待用户凭提货码(\d+)于`)
afsMsgMap = map[string]bool{
jdapi.CallbackMsgNewApplyAfterSaleBill: true,
jdapi.CallbackMsgUpdateApplyAfterSaleBill: true,
jdapi.CallbackMsgNewAfterSaleBill: true,
jdapi.CallbackMsgAfterSaleBillStatus: true,
}
) )
func (c *PurchaseHandler) OnOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) { func (c *PurchaseHandler) OnOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
@@ -72,6 +79,9 @@ func (c *PurchaseHandler) updateOrderFinancialInfo(a *jdapi.API, orderID string)
func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) { func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
a := getAPI(vendorOrgCode) a := getAPI(vendorOrgCode)
if afsMsgMap[msg.MsgURL] {
retVal = c.OnAfsOrderMsg(a, msg)
} else {
status := c.callbackMsg2Status(msg) status := c.callbackMsg2Status(msg)
if jdapi.StatusIDNewOrder == msg.StatusID { if jdapi.StatusIDNewOrder == msg.StatusID {
status.Status = model.OrderStatusNew // 因为京东将事件32000与状态32000混用事件32000可能是新订单也可能是已接单统一当成新订单处理 status.Status = model.OrderStatusNew // 因为京东将事件32000与状态32000混用事件32000可能是新订单也可能是已接单统一当成新订单处理
@@ -82,8 +92,6 @@ func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOr
if msg.MsgURL == jdapi.CallbackMsgOrderAccounting { if msg.MsgURL == jdapi.CallbackMsgOrderAccounting {
retVal = c.OnFinancialMsg(msg) retVal = c.OnFinancialMsg(msg)
retVal = jdapi.Err2CallbackResponse(c.updateOrderFinancialInfo(a, msg.BillID), status.VendorStatus) retVal = jdapi.Err2CallbackResponse(c.updateOrderFinancialInfo(a, msg.BillID), status.VendorStatus)
} else if msg.MsgURL == jdapi.CallbackMsgAfterSaleBillStatus {
retVal = c.OnAfsOrderMsg(a, msg)
} else { } else {
// 新订单事件,与订单状态有点冲突 // 新订单事件,与订单状态有点冲突
if jdapi.StatusIDNewOrder == msg.StatusID { if jdapi.StatusIDNewOrder == msg.StatusID {
@@ -100,6 +108,7 @@ func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOr
retVal = jdapi.Err2CallbackResponse(err, status.VendorStatus) retVal = jdapi.Err2CallbackResponse(err, status.VendorStatus)
} }
} }
}
return retVal return retVal
} }

View File

@@ -14,6 +14,7 @@ var (
AfsVendorStatus2StatusMap = map[string]int{ AfsVendorStatus2StatusMap = map[string]int{
jdapi.AfsServiceStateWaiting4Audit: model.AfsOrderStatusWait4Approve, // 需要审核 jdapi.AfsServiceStateWaiting4Audit: model.AfsOrderStatusWait4Approve, // 需要审核
jdapi.AfsServiceStateWaiting4CSFeedback: model.AfsOrderStatusNew,
jdapi.AfsServiceStateRefundProcessing: model.AfsOrderStatusNew, jdapi.AfsServiceStateRefundProcessing: model.AfsOrderStatusNew,
jdapi.AfsServiceStateWaiting4DirectCompensate: model.AfsOrderStatusNew, jdapi.AfsServiceStateWaiting4DirectCompensate: model.AfsOrderStatusNew,
jdapi.AfsServiceStateWaiting4ReturnGoods: model.AfsOrderStatusNew, jdapi.AfsServiceStateWaiting4ReturnGoods: model.AfsOrderStatusNew,

View File

@@ -180,15 +180,15 @@ func (c *DjswController) DeliveryCarrierModify() {
} }
func (c *DjswController) NewApplyAfterSaleBill() { func (c *DjswController) NewApplyAfterSaleBill() {
c.nullOperation() c.orderStatus()
} }
func (c *DjswController) UpdateApplyAfterSaleBill() { func (c *DjswController) UpdateApplyAfterSaleBill() {
c.nullOperation() c.orderStatus()
} }
func (c *DjswController) NewAfterSaleBill() { func (c *DjswController) NewAfterSaleBill() {
c.nullOperation() c.orderStatus()
} }
func (c *DjswController) AfterSaleBillStatus() { func (c *DjswController) AfterSaleBillStatus() {