1
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package tiktok_store
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
instantShopping_getDeliveryListByOrderId_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_getDeliveryListByOrderId/response"
|
||||
|
||||
superm_getShipmentInfo_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getShipmentInfo/response"
|
||||
superm_getStoreAutoCallRiderInfo_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getStoreAutoCallRiderInfo/response"
|
||||
superm_setStoreAutoCallRider_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_setStoreAutoCallRider/request"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
@@ -55,22 +55,21 @@ func (c *PurchaseHandler) onWaybillMsg(tag, orderId string, data interface{}) *t
|
||||
func (c *PurchaseHandler) callbackMsg2Waybill(tag, orderId string, data interface{}) (retVal *model.Waybill) {
|
||||
req := data.(tiktok_api.ShipmentInfoData)
|
||||
tempRemark := ""
|
||||
if req.ShipmentStatus == tiktok_api.ShipmentStatusReceived {
|
||||
if req.Status == tiktok_api.ShipmentStatusReceived {
|
||||
tempRemark = req.RiderName + "," + req.RiderPhone
|
||||
}
|
||||
return &model.Waybill{
|
||||
VendorOrderID: utils.Int64ToStr(req.ShopOrderID),
|
||||
OrderVendorID: model.VendorIDDD,
|
||||
VendorWaybillID: req.TrackNo,
|
||||
VendorWaybillID: utils.Int64ToStr(req.ShopOrderID),
|
||||
WaybillVendorID: model.VendorIDDD,
|
||||
CourierName: req.RiderName,
|
||||
CourierMobile: req.RiderPhone,
|
||||
VendorStatus: utils.Int64ToStr(req.ShipmentStatus),
|
||||
Status: c.GetWaybillStatusFromVendorStatus(utils.Int64ToStr(req.ShipmentStatus)),
|
||||
StatusTime: utils.Str2Time(req.OccurredTime),
|
||||
//StatusTime: getTimeFromTimestamp(utils.Str2Int64(req.OccurredTime)),
|
||||
Remark: tempRemark,
|
||||
VendorOrgCode: utils.Int64ToStr(req.ShopID), //为抖音账号ID
|
||||
VendorStatus: utils.Int64ToStr(req.Status),
|
||||
Status: c.GetWaybillStatusFromVendorStatus(utils.Int64ToStr(req.Status)),
|
||||
StatusTime: utils.Str2Time(req.OperateTime),
|
||||
Remark: tempRemark,
|
||||
VendorOrgCode: utils.Int64ToStr(req.ShopID), //为抖音账号ID
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +137,7 @@ func (c *PurchaseHandler) CancelWaybill(bill *model.Waybill, cancelReasonID int,
|
||||
}
|
||||
|
||||
//查询运力状态
|
||||
func (c *PurchaseHandler) GetDYPSRiderInfo(orderId string) (*superm_getShipmentInfo_response.ShipmentInfo, error) {
|
||||
func (c *PurchaseHandler) GetDYPSRiderInfo(orderId string) (*instantShopping_getDeliveryListByOrderId_response.InstantShoppingGetDeliveryListByOrderIdData, error) {
|
||||
params := map[string]interface{}{
|
||||
"vendorOrderID": orderId,
|
||||
}
|
||||
@@ -146,9 +145,11 @@ func (c *PurchaseHandler) GetDYPSRiderInfo(orderId string) (*superm_getShipmentI
|
||||
if err != nil {
|
||||
return nil, errors.New("获取本地门店账号信息失败,请重试")
|
||||
}
|
||||
if waybill, err := getAPI(orderInfo[0].VendorOrgCode, 0, "").GetShipmentInfo(utils.Str2Int64(orderId), 0, tiktok_api.ShipmentTypeInvoice); err != nil {
|
||||
|
||||
waybill, err := getAPI(orderInfo[0].VendorOrgCode, 0, "").GetShipmentInfo(utils.Str2Int64(orderId), 0, tiktok_api.ShipmentTypeInvoice)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return waybill, nil
|
||||
}
|
||||
|
||||
return waybill, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user