增加运力api
This commit is contained in:
86
platformapi/tiktok_shop/tiktok_api/transport.go
Normal file
86
platformapi/tiktok_shop/tiktok_api/transport.go
Normal file
@@ -0,0 +1,86 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
superm_applyPlatformPickUp_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_applyPlatformPickUp/request"
|
||||
superm_cancelPlatformPickUp_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_cancelPlatformPickUp/request"
|
||||
superm_getPlatformPickUpEstimatedCharge_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getPlatformPickUpEstimatedCharge/request"
|
||||
superm_getShipmentInfo_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getShipmentInfo/request"
|
||||
superm_getShipmentInfo_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getShipmentInfo/response"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
// /superm/getPlatformPickUpEstimatedCharge 运力呼叫询价/运力取消询价(逆向)
|
||||
func (a *API) getPlatformPickUpEstimatedCharge(afterSaleID int64, inquiryType int32) (int64, error) {
|
||||
request := superm_getPlatformPickUpEstimatedCharge_request.New()
|
||||
request.Param = &superm_getPlatformPickUpEstimatedCharge_request.SupermGetPlatformPickUpEstimatedChargeParam{
|
||||
AfterSaleID: afterSaleID,
|
||||
InquiryType: inquiryType,
|
||||
}
|
||||
response, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("运力呼叫询价/运力取消询价=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("运力呼叫询价/运力取消询价:=%s", utils.Format4Output(response, false))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if response.Code != RequestSuccessCode {
|
||||
return 0, errors.New(response.SubMsg)
|
||||
}
|
||||
return response.Data.PlatformPickupEstimatedCharge, err
|
||||
}
|
||||
|
||||
// /superm/applyPlatformPickUp 呼叫运力售后取件
|
||||
func (a *API) ApplyPlatformPickUp(afterSaleID int64) (string, error) {
|
||||
request := superm_applyPlatformPickUp_request.New()
|
||||
request.Param = &superm_applyPlatformPickUp_request.SupermApplyPlatformPickUpParam{
|
||||
AfterSaleID: afterSaleID,
|
||||
}
|
||||
response, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("呼叫运力售后取件=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("呼叫运力售后取件:=%s", utils.Format4Output(response, false))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if response.Code != RequestSuccessCode {
|
||||
return "", errors.New(response.SubMsg)
|
||||
}
|
||||
return response.Data.LogisticsID, err
|
||||
}
|
||||
|
||||
// /superm/getShipmentInfo 查询运力订单信息
|
||||
func (a *API) GetShipmentInfo(shopOrderID, afterSaleID, shipmentType int64) (*superm_getShipmentInfo_response.ShipmentInfo, error) {
|
||||
request := superm_getShipmentInfo_request.New()
|
||||
request.Param = &superm_getShipmentInfo_request.SupermGetShipmentInfoParam{
|
||||
ShopOrderID: shopOrderID,
|
||||
ShipmentType: shipmentType,
|
||||
}
|
||||
response, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("查询运力订单信息=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("查询运力订单信息:=%s", utils.Format4Output(response, false))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code != RequestSuccessCode {
|
||||
return nil, errors.New(response.SubMsg)
|
||||
}
|
||||
return response.Data.ShipmentInfo, err
|
||||
}
|
||||
|
||||
// /superm/cancelPlatformPickUp 取消运力 (逆向)
|
||||
func (a *API) CancelPlatformPickUp(afterSaleID int64) error {
|
||||
request := superm_cancelPlatformPickUp_request.New()
|
||||
request.Param = &superm_cancelPlatformPickUp_request.SupermCancelPlatformPickUpParam{
|
||||
AfterSaleID: afterSaleID,
|
||||
}
|
||||
response, err := request.Execute(a.accessTokenObj)
|
||||
globals.SugarLogger.Debugf("取消运力=========:%s", request.GetUrlPath())
|
||||
globals.SugarLogger.Debugf("取消运力:=%s", utils.Format4Output(response, false))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if response.Code != RequestSuccessCode {
|
||||
return errors.New(response.SubMsg)
|
||||
}
|
||||
return err
|
||||
}
|
||||
78
platformapi/tiktok_shop/tiktok_api/transport_model.go
Normal file
78
platformapi/tiktok_shop/tiktok_api/transport_model.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package tiktok_api
|
||||
|
||||
const (
|
||||
DispatcherFeeTypeCall = 1 //呼叫运力
|
||||
DispatcherFeeTypeCancel = 2 //取消运力
|
||||
|
||||
InquiryTypeDelivery = 1 //配送 默认
|
||||
InquiryTypeCancel = 2 //取消
|
||||
|
||||
ServiceTypeCallNow = 0 //立即呼叫
|
||||
ServiceTypeDelayCall = 1 //延迟呼叫
|
||||
|
||||
ServiceStatusClose = 1 //自动呼叫运力设置关闭
|
||||
ServiceStatusOpen = 2 //自动呼叫运力设置开启
|
||||
|
||||
ShipmentTypeInvoice = 1 //发货单
|
||||
ShipmentTypeVisitInDoor = 2 //上门取
|
||||
)
|
||||
|
||||
const (
|
||||
ShipmentStatusCalling = 1
|
||||
ShipmentStatusReceived = 2
|
||||
ShipmentStatusArrived = 3
|
||||
ShipmentStatusDelivering = 4
|
||||
ShipmentStatusRejected = 5
|
||||
ShipmentStatusReturning = 6
|
||||
ShipmentStatusReturned = 7
|
||||
ShipmentStatusDelivered = 8
|
||||
ShipmentStatusCanceled = 9
|
||||
)
|
||||
|
||||
var ShipmentStatus = map[int]string{
|
||||
ShipmentStatusCalling: "骑手呼叫中",
|
||||
ShipmentStatusReceived: "骑手已接单",
|
||||
ShipmentStatusArrived: "骑手已到取货点",
|
||||
ShipmentStatusDelivering: "骑手配送中",
|
||||
ShipmentStatusRejected: "收货人已拒收",
|
||||
ShipmentStatusReturning: "返回中",
|
||||
ShipmentStatusReturned: "返回完成",
|
||||
ShipmentStatusDelivered: "订单妥投",
|
||||
ShipmentStatusCanceled: "订单取消",
|
||||
}
|
||||
|
||||
const (
|
||||
ShipmentErrorMerchantDeliverSlow = 1001
|
||||
ShipmentErrorMerchantDeliverError = 1002
|
||||
ShipmentErrorMerchantStockOut = 1003
|
||||
ShipmentErrorGoodsDamaged = 2001
|
||||
ShipmentErrorGoodsLost = 2002
|
||||
ShipmentErrorRiderWrongGoods = 2003
|
||||
ShipmentErrorRiderUndeliverable = 2004
|
||||
ShipmentErrorWrongReceiptCode = 3001
|
||||
ShipmentErrorMerchantWrongAddress = 3002
|
||||
ShipmentErrorConsumerWrongAddress = 3003
|
||||
ShipmentErrorWeightDeviationTooLarge = 3004
|
||||
ShipmentErrorConsumerCallNoAnswer = 4002
|
||||
ShipmentErrorConsumerStayOut = 4003
|
||||
ShipmentErrorConsumerModifyAddress = 4004
|
||||
ShipmentErrorOther = 5001
|
||||
)
|
||||
|
||||
var ShipmentError = map[int]string{
|
||||
ShipmentErrorMerchantDeliverSlow: "商家出货慢",
|
||||
ShipmentErrorMerchantDeliverError: "商家出错货",
|
||||
ShipmentErrorMerchantStockOut: "商家缺货",
|
||||
ShipmentErrorGoodsDamaged: "破损",
|
||||
ShipmentErrorGoodsLost: "丢失",
|
||||
ShipmentErrorRiderWrongGoods: "骑手取错货",
|
||||
ShipmentErrorRiderUndeliverable: "骑手无法送达",
|
||||
ShipmentErrorWrongReceiptCode: "小票码错误",
|
||||
ShipmentErrorMerchantWrongAddress: "商家地址错误",
|
||||
ShipmentErrorConsumerWrongAddress: "消费者地址错误",
|
||||
ShipmentErrorWeightDeviationTooLarge: "订单重量偏差过大",
|
||||
ShipmentErrorConsumerCallNoAnswer: "消费者电话未接通",
|
||||
ShipmentErrorConsumerStayOut: "消费者不在家",
|
||||
ShipmentErrorConsumerModifyAddress: "消费者线下联系修改地址",
|
||||
ShipmentErrorOther: "其他",
|
||||
}
|
||||
Reference in New Issue
Block a user