1
This commit is contained in:
@@ -468,6 +468,12 @@ func (a *API) CreateOrderCallback(orderStatus []byte) (map[string][]interface{},
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
callbackResult[CallbackRefundClosedMsgTagId] = append(callbackResult[CallbackRefundClosedMsgTagId], create)
|
||||
case CallbackShipmentInfoChange: //运单状态回调
|
||||
create := ShipmentInfoData{}
|
||||
if err := json.Unmarshal([]byte(data.Data), &create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
callbackResult[CallbackShipmentInfoChange] = append(callbackResult[CallbackShipmentInfoChange], create)
|
||||
default:
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
@@ -606,6 +612,13 @@ func (a *API) GetCallbackOrderId(msgId string, data interface{}) (string, int64,
|
||||
return "", 0, CallbackResponseErr(false)
|
||||
}
|
||||
return utils.Int64ToStr(create.PId), int64(create.ShopId), Err2CallbackResponse(nil, "")
|
||||
case CallbackShipmentInfoChange: //商家从运力平台呼叫运力以后,推送运力状态变更消息
|
||||
create := ShipmentInfoData{}
|
||||
if err := utils.Map2StructByJson(data, &create, false); err != nil {
|
||||
return "", 0, CallbackResponseErr(false)
|
||||
}
|
||||
//返回 骑手运单号 抖音店铺ID
|
||||
return create.TrackNo, create.ShopID, Err2CallbackResponse(nil, "")
|
||||
default:
|
||||
return "", 0, CallbackResponseErr(false)
|
||||
}
|
||||
|
||||
@@ -4,15 +4,77 @@ 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_createVirtualMobile_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/request"
|
||||
superm_createVirtualMobile_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response"
|
||||
superm_getDispatcherInfo_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/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"
|
||||
superm_orderDispatcher_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/request"
|
||||
"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) {
|
||||
// /superm/getDispatcherInfo 运力呼叫询价/运力取消询价(正向)
|
||||
func (a *API) GetDispatcherInfo(storeID, shopOrderID int64, dispatcherType int32) (int64, error) {
|
||||
request := superm_getDispatcherInfo_request.New()
|
||||
request.Param = &superm_getDispatcherInfo_request.SupermGetDispatcherInfoParam{
|
||||
StoreID: storeID,
|
||||
ShopOrderID: shopOrderID,
|
||||
DispatcherType: dispatcherType,
|
||||
}
|
||||
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.DispatcherFee, nil
|
||||
}
|
||||
|
||||
// /superm/orderDispatcher 呼叫运力并发货/重新发货、取消运力
|
||||
func (a *API) OrderDispatcher(storeID, shopOrderID int64, dispatcherType int32) error {
|
||||
request := superm_orderDispatcher_request.New()
|
||||
request.Param = &superm_orderDispatcher_request.SupermOrderDispatcherParam{
|
||||
StoreID: storeID,
|
||||
ShopOrderID: shopOrderID,
|
||||
DispatcherType: dispatcherType,
|
||||
}
|
||||
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 nil
|
||||
}
|
||||
|
||||
// /superm/createVirtualMobile 隐私小号获取
|
||||
func (a *API) CreateVirtualMobile(shopOrderID int64) (*superm_createVirtualMobile_response.SupermCreateVirtualMobileData, error) {
|
||||
request := superm_createVirtualMobile_request.New()
|
||||
request.Param = &superm_createVirtualMobile_request.SupermOrderDispatcherParam{
|
||||
ShopOrderID: shopOrderID,
|
||||
}
|
||||
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, nil
|
||||
}
|
||||
|
||||
// /superm/getPlatformPickUpEstimate]dCharge 运力呼叫询价/运力取消询价(逆向)
|
||||
func (a *API) GetPlatformPickUpEstimatedCharge(afterSaleID int64, inquiryType int32) (int64, error) {
|
||||
request := superm_getPlatformPickUpEstimatedCharge_request.New()
|
||||
request.Param = &superm_getPlatformPickUpEstimatedCharge_request.SupermGetPlatformPickUpEstimatedChargeParam{
|
||||
AfterSaleID: afterSaleID,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tiktok_api
|
||||
|
||||
const CallbackShipmentInfoChange = "12001" //小时达运力状态变更标识
|
||||
|
||||
const (
|
||||
DispatcherFeeTypeCall = 1 //呼叫运力
|
||||
DispatcherFeeTypeCancel = 2 //取消运力
|
||||
@@ -29,7 +31,7 @@ const (
|
||||
ShipmentStatusCanceled = 9
|
||||
)
|
||||
|
||||
var ShipmentStatus = map[int]string{
|
||||
var ShipmentStatus = map[int64]string{
|
||||
ShipmentStatusCalling: "骑手呼叫中",
|
||||
ShipmentStatusReceived: "骑手已接单",
|
||||
ShipmentStatusArrived: "骑手已到取货点",
|
||||
@@ -76,3 +78,17 @@ var ShipmentError = map[int]string{
|
||||
ShipmentErrorConsumerModifyAddress: "消费者线下联系修改地址",
|
||||
ShipmentErrorOther: "其他",
|
||||
}
|
||||
|
||||
//小时达运力状态变更消息体
|
||||
type ShipmentInfoData struct {
|
||||
AfterSaleID int64 `json:"afterSaleID"` //上门取运力对应售后单号
|
||||
TrackNo string `json:"trackNo"` //骑手配送运单号
|
||||
RiderName string `json:"riderName"` //骑手名称
|
||||
RiderPhone string `json:"riderPhone"` //骑手电话
|
||||
RiderLatitude string `json:"riderLatitude"` //骑手坐标纬度
|
||||
RiderLongitude string `json:"riderLongitude"` //骑手坐标经度
|
||||
ShopOrderID int64 `json:"shopOrderID"` //店铺订单号
|
||||
ShopID int64 `json:"shopID"` //抖店门店ID
|
||||
ShipmentStatus int64 `json:"shipmentStatus"` //运单状态
|
||||
OccurredTime string `json:"occurredTime"` //当前状态变更时间
|
||||
}
|
||||
|
||||
8
platformapi/tiktok_shop/tiktok_api/transport_test.go
Normal file
8
platformapi/tiktok_shop/tiktok_api/transport_test.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package tiktok_api
|
||||
|
||||
import "testing"
|
||||
|
||||
//运力呼叫询价(正向)
|
||||
func TestGetDispatcherInfo(t *testing.T) {
|
||||
//dispatcherFee, err := a.GetDispatcherInfo()
|
||||
}
|
||||
Reference in New Issue
Block a user