This commit is contained in:
邹宗楠
2022-11-04 21:06:40 +08:00
parent 6cb56693d8
commit 24e92bb70c
2 changed files with 83 additions and 33 deletions

View File

@@ -99,7 +99,9 @@ func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap
err := dadaapi.Err2CallbackResponse(partner.CurOrderManager.OnWaybillStatusChanged(order), utils.Int2Str(order.Status))
defer func(order *model.Waybill) {
delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID, order.Status) // 骑手位置更新
delivery.PullTiktokRiderInfo(&mtpsapi.RiderInfo{
}(order)
if order.OrderVendorID == model.VendorIDDD {
result := &mtpsapi.RiderInfo{
OrderId: order.VendorOrderID,
ThirdCarrierOrderId: order.VendorOrderID,
CourierName: order.CourierName,
@@ -107,8 +109,44 @@ func (c *DeliveryHandler) onWaybillMsg(msg *dadaapi.CallbackMsg) (retVal *dadaap
LogisticsProviderCode: "10002",
LogisticsStatus: order.Status,
OpCode: "",
})
}(order)
}
switch order.Status {
case dadaapi.OrderStatusWaitingForAccept: // 待接单,召唤骑手
result.LogisticsStatus = model.WaybillStatusNew
result.LogisticsContext = model.RiderWaitRider
case dadaapi.OrderStatusAccepted: // 待取货
result.LogisticsStatus = model.WaybillStatusCourierAssigned // 分配骑手
result.LogisticsContext = model.RiderWaitGetGoods
case dadaapi.OrderStatusDelivering: // 配送中
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
case dadaapi.OrderStatusFinished: // 完成
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case dadaapi.OrderStatusCanceled: // 取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
case 8: // 指派单,不处理
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
case 9: // 配送异常返回值
result.LogisticsStatus = model.WaybillStatusDeliverFailed
result.LogisticsContext = model.RiderGetOrderDeliverFailed
case 10: // 妥投异常之物品返回完成 - 不处理
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
case dadaapi.OrderStatusReturningInOrder: // 骑手到店
result.LogisticsStatus = model.WaybillStatusCourierArrived
result.LogisticsContext = model.RiderToStore
case dadaapi.OrderStatusAddOrderFailed: // 创建达达运单失败 - 不处理
result.LogisticsStatus = model.WaybillStatusFailed
result.LogisticsContext = model.RiderGetOrderDeliverOther
default:
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
delivery.PullTiktokRiderInfo(result)
}
return err
}