添加淘鲜达

This commit is contained in:
邹宗楠
2023-06-28 10:04:08 +08:00
parent 64e4339aeb
commit c0a97b4fad
51 changed files with 2109 additions and 2007 deletions

View File

@@ -69,7 +69,6 @@ func (c *DeliveryHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int,
}
parameter.PartnerOrderCode = bill.VendorOrderID
if err = api.FnAPI.CancelOrder(parameter); err != nil {
globals.SugarLogger.Debugf("============err := %v ", err)
if strings.Contains(err.Error(), "运单暂未生成") {
err = nil
}
@@ -280,49 +279,55 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify, resultParam *fnpsapi.ShortSta
return fnpsapi.Err2CallbackResponse(err, "")
}
if order.OrderVendorID == model.VendorIDDD {
result := &mtpsapi.RiderInfo{
OrderId: order.VendorOrderID,
ThirdCarrierOrderId: order.VendorOrderID,
CourierName: order.CourierName,
CourierPhone: order.CourierMobile,
LogisticsProviderCode: "10002",
LogisticsStatus: order.Status,
OpCode: "",
}
switch orderStatus {
case fnpsapi.OrderStatusAcceptCreate, fnpsapi.OrderStatusAccept: // 待接单,召唤骑手
result.LogisticsStatus = model.WaybillStatusNew
result.LogisticsContext = model.RiderWaitRider
case fnpsapi.OrderStatusAssigned: //20分配骑手 待取货
result.LogisticsStatus = model.WaybillStatusCourierAssigned // 分配骑手
result.LogisticsContext = model.RiderWaitGetGoods
case fnpsapi.OrderStatusDelivering: // 2 配送中 // 配送中
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
case fnpsapi.OrderStatusDelivered: // 3 已经送达 // 完成
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case fnpsapi.OrderStatusAcceptCacle: // 取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
case fnpsapi.OrderStatusException: // 5 异常: // 配送异常返回值
result.LogisticsStatus = model.WaybillStatusDeliverFailed
result.LogisticsContext = model.RiderGetOrderDeliverFailed
case fnpsapi.OrderStatusArrived: // 80 到店 // 骑手到店
result.LogisticsStatus = model.WaybillStatusCourierArrived
result.LogisticsContext = model.RiderToStore
default:
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
delivery.PullTiktokRiderInfo(result)
switch order.OrderVendorID {
case model.VendorIDDD:
tiktokStatusPush(order, orderStatus)
case model.VendorIDMTWM, model.VendorIDTaoVegetable:
delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID, order.Status) // 骑手位置更新
}
defer delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID, order.Status) // 骑手位置更新
return fnpsapi.Err2CallbackResponse(nil, "")
}
// 抖音订单状态回传
func tiktokStatusPush(order *model.Waybill, orderStatus int64) {
result := &mtpsapi.RiderInfo{
OrderId: order.VendorOrderID,
ThirdCarrierOrderId: order.VendorOrderID,
CourierName: order.CourierName,
CourierPhone: order.CourierMobile,
LogisticsProviderCode: "10002",
LogisticsStatus: order.Status,
OpCode: "",
}
switch orderStatus {
case fnpsapi.OrderStatusAcceptCreate, fnpsapi.OrderStatusAccept: // 待接单,召唤骑手
result.LogisticsStatus = model.WaybillStatusNew
result.LogisticsContext = model.RiderWaitRider
case fnpsapi.OrderStatusAssigned: //20分配骑手 待取货
result.LogisticsStatus = model.WaybillStatusCourierAssigned // 分配骑手
result.LogisticsContext = model.RiderWaitGetGoods
case fnpsapi.OrderStatusDelivering: // 2 配送中 // 配送中
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
case fnpsapi.OrderStatusDelivered: // 3 已经送达 // 完成
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case fnpsapi.OrderStatusAcceptCacle: // 取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
case fnpsapi.OrderStatusException: // 5 异常: // 配送异常返回值
result.LogisticsStatus = model.WaybillStatusDeliverFailed
result.LogisticsContext = model.RiderGetOrderDeliverFailed
case fnpsapi.OrderStatusArrived: // 80 到店 // 骑手到店
result.LogisticsStatus = model.WaybillStatusCourierArrived
result.LogisticsContext = model.RiderToStore
default:
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
delivery.PullTiktokRiderInfo(result)
}
// 异常报备
func OnWaybillExceptFn(msg *fnpsapi.AbnormalReportNotify) (retVal *fnpsapi.CallbackResponse) {
return CurDeliveryHandler.OnWaybillExcept(msg)