This commit is contained in:
邹宗楠
2023-10-24 10:19:58 +08:00
parent 08c39f4961
commit 0dce9e560d
11 changed files with 60 additions and 63 deletions

View File

@@ -244,7 +244,7 @@ func (p *PurchaseHandler) getOrder(vendorOrgCode, vendorOrderID, vendorStoreID s
func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, param map[string]interface{}) (err error) {
appKey := `7152420904331429407` // 暂时定死
appSecret := `cc7ba367-2394-4cbb-81c6-26f0e929d1c6` //暂时定死
return tiktokShop.NewExpress(appKey, appSecret, "").OrderStatusAndPsInfo(param)
return tiktokShop.NewExpress(appKey, appSecret, "").OrderStatusAndPsInfoNew(param)
}
func (p *PurchaseHandler) GetOrder(vendorOrgCode, vendorOrderID, vendorStoreID string) (order *model.GoodsOrder, err error) {
@@ -287,7 +287,6 @@ func (c *PurchaseHandler) onOrderMsg(msgId, orderId string, msg interface{}) (re
//抖音运单处理
if msgId == tiktokShop.CallbackShipmentInfoChange {
//msgId-骑手运单号 orderId-抖音店铺ID msg-回调运单参数
return c.onWaybillMsg(msgId, orderId, msg)
}
// 待支付订单将不做处理/支付订单待处理(抖音风控)
@@ -577,16 +576,15 @@ func (c *PurchaseHandler) CanSwitch2SelfDeliver(order *model.GoodsOrder) (isCan
// Swtich2SelfDeliver 抖音转自送的时候就是通知抖音发货了
func (c *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName string) (err error) {
api := getAPI(order.VendorOrgCode, 0, "")
remoteWaybill, err2 := c.GetDYPSRiderInfo(order.VendorOrderID)
if err2 != nil {
return err2
}
if remoteWaybill.ShipmentStatus >= tiktokShop.ShipmentStatusArrived && remoteWaybill.ShipmentStatus != tiktokShop.ShipmentStatusCanceled { //骑手取货后不可取消
return errors.New("抖音配送骑手已取货,不可转门店自配送/三方配送")
}
if len(remoteWaybill.TrackNo) != 0 { //存在运单
if err := api.ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktokShop.DispatcherFeeTypeCancel); err != nil {
return err
remoteWaybill, _ := c.GetDYPSRiderInfo(order.VendorOrderID)
if remoteWaybill != nil {
if remoteWaybill.Status >= tiktokShop.ShipmentStatusArrived && remoteWaybill.Status != tiktokShop.ShipmentStatusCanceled { //骑手取货后不可取消
return errors.New("抖音配送骑手已取货,不可转门店自配送/三方配送")
}
if remoteWaybill.Status < tiktokShop.ShipmentStatusArrived || remoteWaybill.Status == tiktokShop.ShipmentStatusCanceled { //存在运单
if err := api.ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktokShop.DispatcherFeeTypeCancel); err != nil {
return err
}
}
}
@@ -996,13 +994,13 @@ func (c *PurchaseHandler) OrderLogisticsStatus(orderId string) (data *utils.Ride
}
result := &utils.RiderInfo{
OrderId: utils.Int64ToStr(waybill.ShopOrderID),
ThirdCarrierOrderId: waybill.TrackNo,
OrderId: waybill.ShopOrderId,
ThirdCarrierOrderId: waybill.ShopOrderId,
CourierName: waybill.RiderName,
CourierPhone: waybill.RiderPhone,
LogisticsStatus: int(waybill.ShipmentStatus),
Latitude: waybill.RiderLatitude,
Longitude: waybill.RiderLongitude,
LogisticsStatus: int(waybill.Status),
Latitude: waybill.RiderLat,
Longitude: waybill.RiderLng,
}
return result, nil
}