修改打印机打印数据

This commit is contained in:
邹宗楠
2022-12-05 17:02:47 +08:00
parent c8c33d38c1
commit a1847b2aae
3 changed files with 172 additions and 58 deletions

View File

@@ -127,47 +127,51 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
err := mtpsapi.Err2CallbackResponse(partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus)
defer delivery.GetOrderRiderInfoToPlatform(order.VendorOrderID, order.Status) // 骑手位置更新
if order.OrderVendorID == model.VendorIDDD {
result := &mtpsapi.RiderInfo{
OrderId: order.VendorOrderID,
ThirdCarrierOrderId: order.VendorOrderID,
CourierName: order.CourierName,
CourierPhone: order.CourierMobile,
LogisticsProviderCode: "10032",
LogisticsStatus: order.Status,
OpCode: "",
}
switch msg.Status {
case mtpsapi.OrderStatusWaitingForSchedule: // 待接单,召唤骑手
result.LogisticsStatus = model.WaybillStatusNew
result.LogisticsContext = model.RiderWaitRider
case mtpsapi.OrderStatusAccepted: // 已接单
result.LogisticsStatus = model.WaybillStatusCourierAssigned // 分配骑手
result.LogisticsContext = model.RiderWaitGetGoods
case mtpsapi.OrderStatusDeliverred: // 完成
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case mtpsapi.OrderStatusCanceled: // 取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
case mtpsapi.OrderStatusPickedUp: // 骑手到店
result.LogisticsStatus = model.WaybillStatusCourierArrived
result.LogisticsContext = model.RiderToStore
default:
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
globals.SugarLogger.Debugf("===========================mtps:%s", utils.Format4Output(result, false))
delivery.PullTiktokRiderInfo(result)
if result.LogisticsStatus == model.WaybillStatusCourierArrived {
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
delivery.PullTiktokRiderInfo(result)
}
pushMTPSToTiktok(msg.Status, order)
}
return err
}
func pushMTPSToTiktok(msgStatus int, order *model.Waybill) {
result := &mtpsapi.RiderInfo{
OrderId: order.VendorOrderID,
ThirdCarrierOrderId: order.VendorOrderID,
CourierName: order.CourierName,
CourierPhone: order.CourierMobile,
LogisticsProviderCode: "10032",
LogisticsStatus: order.Status,
OpCode: "",
}
switch msgStatus {
case mtpsapi.OrderStatusWaitingForSchedule: // 待接单,召唤骑手
result.LogisticsStatus = model.WaybillStatusNew
result.LogisticsContext = model.RiderWaitRider
case mtpsapi.OrderStatusAccepted: // 已接单
result.LogisticsStatus = model.WaybillStatusCourierAssigned // 分配骑手
result.LogisticsContext = model.RiderWaitGetGoods
case mtpsapi.OrderStatusDeliverred: // 完成
result.LogisticsStatus = model.WaybillStatusDelivered
result.LogisticsContext = model.RiderGetOrderDelivered
case mtpsapi.OrderStatusCanceled: // 取消
result.LogisticsStatus = model.WaybillStatusCanceled
result.LogisticsContext = model.RiderGetOrderCanceled
case mtpsapi.OrderStatusPickedUp: // 骑手到店
result.LogisticsStatus = model.WaybillStatusCourierArrived
result.LogisticsContext = model.RiderToStore
default:
result.LogisticsStatus = 0
result.LogisticsContext = model.RiderGetOrderDeliverOther
}
globals.SugarLogger.Debugf("===========================mtps:%s", utils.Format4Output(result, false))
delivery.PullTiktokRiderInfo(result)
if result.LogisticsStatus == model.WaybillStatusCourierArrived {
result.LogisticsStatus = model.WaybillStatusDelivering
result.LogisticsContext = model.RiderGetOrderDelivering
delivery.PullTiktokRiderInfo(result)
}
}
func (c *DeliveryHandler) pushToGy(msg *mtpsapi.CallbackOrderMsg) {
cl := http.Client{}
params := make(map[string]interface{})