This commit is contained in:
richboo111
2023-10-25 09:28:25 +08:00
36 changed files with 729 additions and 134 deletions

View File

@@ -182,7 +182,7 @@ func (a *API) AccessAPI(apiStr string, params map[string]interface{}) (retVal in
}
newErr := utils.NewErrorIntCode(utils.Interface2String(jsonResult1["message"]), status)
if _, ok := exceedLimitCodes[status]; ok {
return platformapi.ErrLevelExceedLimit, newErr
return platformapi.ErrLevelRecoverableErr, newErr
} else if _, ok := canRetryCodes[status]; ok {
return platformapi.ErrLevelRecoverableErr, newErr
} else {
@@ -239,7 +239,7 @@ func (a *API) DirectionLiteRide(coords []*Coordinate) (retVal interface{}, err e
func (a *API) AccessAPI2(apiStr string, param url.Values) (retVal interface{}, err error) {
for _, v := range BaidunaviAKList {
for _, v := range BaiduAKList {
param.Add("ak", v)
param.Add("output", "json")
params2 := map[string]interface{}{}

View File

@@ -9,4 +9,4 @@ const (
)
var BaidunaviAKList = []string{BaiduAK1, BaiduAK2, BaiduAK3, BaiduAK4, BaiduAK5}
var BaiduAKList = []string{BaiduAK1, BaiduAK2, BaiduAK3, BaiduAK4, BaiduAK5}

View File

@@ -57,7 +57,7 @@ func init() {
}
func TestComplaintRider(t *testing.T) {
err := dadaapi.ComplaintRider("1100562620683968937", 69)
err := dadaapi.ComplaintRider("5000952191610480635", 69)
fmt.Println(err)
}

View File

@@ -280,7 +280,8 @@ func (a *API) AccessAPI2(baseURL, action string, params map[string]interface{})
retVal.Message, _ = jsonResult1[msgKey].(string)
newErr := utils.NewErrorIntCode(retVal.Message, code)
if _, ok := exceedLimitCodes[code]; ok {
return platformapi.ErrLevelExceedLimit, newErr
//return platformapi.ErrLevelExceedLimit, newErr
return platformapi.ErrLevelRecoverableErr, newErr
}
return platformapi.ErrLevelCodeIsNotOK, newErr
})

View File

@@ -91,7 +91,7 @@ func TestCancelOrder(t *testing.T) {
}
func TestEvaluateRider(t *testing.T) {
err := api.EvaluateRider(123456789, "1529387562097059", 1, "just a test")
err := api.EvaluateRider(4614631, "1697594622186088963", 1, "提前点击送达")
if err != nil {
t.Fatal(err)
}

View File

@@ -27,7 +27,11 @@ func init() {
//商超
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_nngsVP37s-HXY86xe85H7Q") //token_n4TwqCntWWuvQwAawzxC0w
<<<<<<< HEAD
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_rfAD6OxSVxkTeCO1XmNCZg") //token_n4TwqCntWWuvQwAawzxC0w
=======
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_rn25Arxm_1JSvQM6CWpJzQ") //token_n4TwqCntWWuvQwAawzxC0w
>>>>>>> 9b9473f25286de4923c0006093e3e6c0a928211c
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;

View File

@@ -298,8 +298,6 @@ func (a *API) RetailBatchInitData(trackInfo, poiCode string, foodDataList []map[
if err == nil {
failedFoodList, err = handleRetailBatchResult(result)
}
globals.SugarLogger.Debugf("result :%s", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("err :%v", err)
return failedFoodList, err
}

View File

@@ -25,7 +25,7 @@ func TestRetailCatUpdate(t *testing.T) {
// 测试获取门店分类列表
func TestRetailCatList(t *testing.T) {
result, err := api.RetailCatList("18900165")
result, err := api.RetailCatList("19284062")
if err != nil {
t.Fatal(err)
}

View File

@@ -21,13 +21,17 @@ func NewTaoVegetable(appKey, appSecret, serverUrl string) *API {
}
type API struct {
client topsdk.TopClient
token string
refreshToken string
client topsdk.TopClient
token string
refreshToken string
vendorOrgCode string
}
func (a *API) GetVendorOrgCode() string {
return a.client.AppKey
return a.vendorOrgCode
}
func (a *API) SetVendorOrgCode(vendorOrgCode string) {
a.vendorOrgCode = vendorOrgCode
}
func (a *API) GetAppSecret() string {

View File

@@ -72,9 +72,12 @@ func (a *API) DelivererChange(req *request2.AlibabaAelophyOrderDelivererChangeRe
//globals.SugarLogger.Debugf("进入 DelivererChange : %s", utils.Format4Output(req, false))
client := ability591.NewAbility591(&a.client)
data, _ := client.AlibabaAelophyOrderDelivererChange(req, a.token)
data, err := client.AlibabaAelophyOrderDelivererChange(req, a.token)
if err != nil {
return err
}
if !*data.ApiResult.Success {
if data != nil && !*data.ApiResult.Success {
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
return fmt.Errorf(*data.ApiResult.ErrMsg)
}

View File

@@ -23,9 +23,11 @@ func TestName(t *testing.T) {
}
func TestGetOrderDetail(t *testing.T) {
requestParam := &request591.AlibabaAelophyOrderGetRequest{OrderGetRequest: &domain591.AlibabaAelophyOrderGetOrderGetRequest{
StoreId: utils.String2Pointer("JX102956"),
BizOrderId: utils.Int64ToPointer(5000947260022600875),
StoreId: utils.String2Pointer("lb229"),
BizOrderId: utils.Int64ToPointer(5000950290614680195),
}}
apiTao.SetToken("50002C01524csKWniqfypk8dbshKRTeFIOIy1a46c0cfgsvodWjsseMsXqpvWvECMj1")
data, err := apiTao.QueryOrderDetail(requestParam)
globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("err := %s", utils.Format4Output(err, false))
@@ -61,8 +63,8 @@ func TestQueryAfsOrderDetail(t *testing.T) {
func TestDeliveryFinishACCEPTED(t *testing.T) {
param := &request591.AlibabaAelophyOrderWorkCallbackRequest{}
param.WorkCallbackRequest = &domain591.AlibabaAelophyOrderWorkCallbackWorkCallbackRequest{
StoreId: utils.String2Pointer("JX102985"),
BizOrderId: utils.Int64ToPointer(5000947518268240783),
StoreId: utils.String2Pointer("lb019"),
BizOrderId: utils.Int64ToPointer(5000952367288620290),
Status: utils.String2Pointer(OrderStatusNew),
StatusRemark: nil,
//DelivererName: utils.String2Pointer("张廷"),
@@ -71,6 +73,8 @@ func TestDeliveryFinishACCEPTED(t *testing.T) {
DelivererCompany: nil,
LogisticsNo: nil,
}
apiTao.SetToken("50002C01524csKWniqfypk8dbshKRTeFIOIy1a46c0cfgsvodWjsseMsXqpvWvECMj1")
//apiTao.SetToken("50002C01524csKWniqfypk8dbshKRTeFIOIy1a46c0cfgsvodWjsseMsXqpvWvECMj1")
err := apiTao.DeliveryFinish(param)
fmt.Println(err)
}

View File

@@ -0,0 +1,54 @@
package instantShopping_cancelDelivery_request
import (
"encoding/json"
instantShopping_cancelDelivery_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_cancelDelivery/response"
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingCancelDeliveryRequest struct {
doudian_sdk.BaseDoudianOpApiRequest
Param *InstantShoppingCancelDeliveryParam
}
func (c *InstantShoppingCancelDeliveryRequest) GetUrlPath() string {
return "/instantShopping/cancelDelivery"
}
func New() *InstantShoppingCancelDeliveryRequest {
request := &InstantShoppingCancelDeliveryRequest{
Param: &InstantShoppingCancelDeliveryParam{},
}
request.SetConfig(doudian_sdk.GlobalConfig)
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
return request
}
func (c *InstantShoppingCancelDeliveryRequest) Execute(accessToken *doudian_sdk.AccessToken) (*instantShopping_cancelDelivery_response.InstantShoppingCancelDeliveryResponse, error) {
responseJson, err := c.GetClient().Request(c, accessToken)
if err != nil {
return nil, err
}
response := &instantShopping_cancelDelivery_response.InstantShoppingCancelDeliveryResponse{}
_ = json.Unmarshal([]byte(responseJson), response)
return response, nil
}
func (c *InstantShoppingCancelDeliveryRequest) GetParamObject() interface{} {
return c.Param
}
func (c *InstantShoppingCancelDeliveryRequest) GetParams() *InstantShoppingCancelDeliveryParam {
return c.Param
}
type InstantShoppingCancelDeliveryParam struct {
// 抖音电商shop order单id
ShopOrderId string `json:"shop_order_id"`
// 门店id
StoreId int64 `json:"store_id"`
// 取消原因详见附录F01
CancelCode int64 `json:"cancel_code"`
}

View File

@@ -0,0 +1,14 @@
package instantShopping_cancelDelivery_response
import (
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingCancelDeliveryResponse struct {
doudian_sdk.BaseDoudianOpApiResponse
Data *InstantShoppingCancelDeliveryData `json:"data"`
}
type InstantShoppingCancelDeliveryData struct {
// 取消价格,单位分
CancelFee int64 `json:"cancel_fee"`
}

View File

@@ -0,0 +1,58 @@
package instantShopping_createDelivery_request
import (
"encoding/json"
instantShopping_createDelivery_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_createDelivery/response"
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingCreateDeliveryRequest struct {
doudian_sdk.BaseDoudianOpApiRequest
Param *InstantShoppingCreateDeliveryParam
}
func (c *InstantShoppingCreateDeliveryRequest) GetUrlPath() string {
return "/instantShopping/createDelivery"
}
func New() *InstantShoppingCreateDeliveryRequest {
request := &InstantShoppingCreateDeliveryRequest{
Param: &InstantShoppingCreateDeliveryParam{},
}
request.SetConfig(doudian_sdk.GlobalConfig)
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
return request
}
func (c *InstantShoppingCreateDeliveryRequest) Execute(accessToken *doudian_sdk.AccessToken) (*instantShopping_createDelivery_response.InstantShoppingCreateDeliveryResponse, error) {
responseJson, err := c.GetClient().Request(c, accessToken)
if err != nil {
return nil, err
}
response := &instantShopping_createDelivery_response.InstantShoppingCreateDeliveryResponse{}
_ = json.Unmarshal([]byte(responseJson), response)
return response, nil
}
func (c *InstantShoppingCreateDeliveryRequest) GetParamObject() interface{} {
return c.Param
}
func (c *InstantShoppingCreateDeliveryRequest) GetParams() *InstantShoppingCreateDeliveryParam {
return c.Param
}
type InstantShoppingCreateDeliveryParam struct {
// 抖音电商shop order单id
ShopOrderId string `json:"shop_order_id"`
// 门店ID
StoreId int64 `json:"store_id"`
// 是否需要取件码0=不需要1=需要)
VerifyCodeType int32 `json:"verify_code_type"`
// 序列码列表,如果包含有多个序列码,请用"_"英文下划线分割(属于数码手机类目的商品订单才需要传序列码。)
SerialNumberList string `json:"serial_number_list"`
// 是否需要收件码true需要false不需要
NeedReceiverCode bool `json:"need_receiver_code"`
}

View File

@@ -0,0 +1,18 @@
package instantShopping_createDelivery_response
import (
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingCreateDeliveryResponse struct {
doudian_sdk.BaseDoudianOpApiResponse
Data *InstantShoppingCreateDeliveryData `json:"data"`
}
type InstantShoppingCreateDeliveryData struct {
// 订单配送距离,单位米
DeliveryDistance int64 `json:"delivery_distance"`
// 订单配送价格,单位分
DeliveryFee int64 `json:"delivery_fee"`
// 四到六位验证码
PickupGoodsCode string `json:"pickup_goods_code"`
}

View File

@@ -0,0 +1,50 @@
package instantShopping_getDeliveryListByOrderId_request
import (
"encoding/json"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_getDeliveryListByOrderId/response"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingGetDeliveryListByOrderIdRequest struct {
doudian_sdk.BaseDoudianOpApiRequest
Param *InstantShoppingGetDeliveryListByOrderIdParam
}
func (c *InstantShoppingGetDeliveryListByOrderIdRequest) GetUrlPath() string {
return "/instantShopping/getDeliveryListByOrderId"
}
func New() *InstantShoppingGetDeliveryListByOrderIdRequest {
request := &InstantShoppingGetDeliveryListByOrderIdRequest{
Param: &InstantShoppingGetDeliveryListByOrderIdParam{},
}
request.SetConfig(doudian_sdk.GlobalConfig)
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
return request
}
func (c *InstantShoppingGetDeliveryListByOrderIdRequest) Execute(accessToken *doudian_sdk.AccessToken) (*instantShopping_getDeliveryListByOrderId_response.InstantShoppingGetDeliveryListByOrderIdResponse, error) {
responseJson, err := c.GetClient().Request(c, accessToken)
if err != nil {
return nil, err
}
response := &instantShopping_getDeliveryListByOrderId_response.InstantShoppingGetDeliveryListByOrderIdResponse{}
_ = json.Unmarshal([]byte(responseJson), response)
return response, nil
}
func (c *InstantShoppingGetDeliveryListByOrderIdRequest) GetParamObject() interface{} {
return c.Param
}
func (c *InstantShoppingGetDeliveryListByOrderIdRequest) GetParams() *InstantShoppingGetDeliveryListByOrderIdParam {
return c.Param
}
type InstantShoppingGetDeliveryListByOrderIdParam struct {
// 抖音电商shop order单id
ShopOrderId string `json:"shop_order_id"`
}

View File

@@ -0,0 +1,54 @@
package instantShopping_getDeliveryListByOrderId_response
import (
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingGetDeliveryListByOrderIdResponse struct {
doudian_sdk.BaseDoudianOpApiResponse
Data *InstantShoppingGetDeliveryListByOrderIdData `json:"data"`
}
type DeliveryStatusHistoryItem struct {
// 骑手纬度
RiderLat string `json:"rider_lat"`
// 骑手经度
RiderLng string `json:"rider_lng"`
// 骑手姓名
RiderName string `json:"rider_name"`
// 状态发送时间时间戳s
OperateTime int64 `json:"operate_time"`
// 运力状态枚举101:待骑手接单102:骑手已接单103:骑手已到店104:骑手已取货200:已送达300:已取消
Status int64 `json:"status"`
}
type InstantShoppingGetDeliveryListByOrderIdData struct {
// 抖音订单id
ShopOrderId string `json:"shop_order_id"`
// 运力状态枚举101:待骑手接单102:骑手已接单103:骑手已到店104:骑手已取货200:已送达300:已取消
Status int64 `json:"status"`
// 抖音配送的该单预计送达开始时间,为时间戳格式,单位为秒
PredictDeliveryTimeStart int64 `json:"predict_delivery_time_start"`
// 抖音配送的该单预计送达结束时间,为时间戳格式,单位为秒
PredictDeliveryTimeEnd int64 `json:"predict_delivery_time_end"`
// 骑手名称
RiderName string `json:"rider_name"`
// 骑手手机号
RiderPhone string `json:"rider_phone"`
// 骑手经度,高德坐标系
RiderLng string `json:"rider_lng"`
// 骑手纬度,高德坐标系
RiderLat string `json:"rider_lat"`
// 取消code
CancelCode int64 `json:"cancel_code"`
// 取消原因
CancelReason string `json:"cancel_reason"`
// 订单配送距离,单位为米
DeliveryDistance int64 `json:"delivery_distance"`
// 订单配送价格,单位为分
DeliveryFee int64 `json:"delivery_fee"`
// 取件码
PickupGoodsCode string `json:"pickup_goods_code"`
// 收件码
DeliveryGoodsCode string `json:"delivery_goods_code"`
// 配送状态历史列表
DeliveryStatusHistory []DeliveryStatusHistoryItem `json:"delivery_status_history"`
}

View File

@@ -0,0 +1,74 @@
package instantShopping_notifyDeliveryStatus_request
import (
"encoding/json"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_notifyDeliveryStatus/response"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingNotifyDeliveryStatusRequest struct {
doudian_sdk.BaseDoudianOpApiRequest
Param *InstantShoppingNotifyDeliveryStatusParam
}
func (c *InstantShoppingNotifyDeliveryStatusRequest) GetUrlPath() string {
return "/instantShopping/notifyDeliveryStatus"
}
func New() *InstantShoppingNotifyDeliveryStatusRequest {
request := &InstantShoppingNotifyDeliveryStatusRequest{
Param: &InstantShoppingNotifyDeliveryStatusParam{},
}
request.SetConfig(doudian_sdk.GlobalConfig)
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
return request
}
func (c *InstantShoppingNotifyDeliveryStatusRequest) Execute(accessToken *doudian_sdk.AccessToken) (*instantShopping_notifyDeliveryStatus_response.InstantShoppingNotifyDeliveryStatusResponse, error) {
responseJson, err := c.GetClient().Request(c, accessToken)
if err != nil {
return nil, err
}
response := &instantShopping_notifyDeliveryStatus_response.InstantShoppingNotifyDeliveryStatusResponse{}
_ = json.Unmarshal([]byte(responseJson), response)
return response, nil
}
func (c *InstantShoppingNotifyDeliveryStatusRequest) GetParamObject() interface{} {
return c.Param
}
func (c *InstantShoppingNotifyDeliveryStatusRequest) GetParams() *InstantShoppingNotifyDeliveryStatusParam {
return c.Param
}
type InstantShoppingNotifyDeliveryStatusParam struct {
// 抖音电商shop order单id
ShopOrderId string `json:"shop_order_id"`
// 三方运力服务商
DistributionCode string `json:"distribution_code"`
// 三方运单号,自配送时传空字符串
DistributionDeliveryId string `json:"distribution_delivery_id"`
// 骑手姓名;骑手已接单/到店/取货/送达状态时必传;
RiderName *string `json:"rider_name"`
// 骑手电话;骑手已接单/到店/取货/送达状态时必传;
RiderPhone *string `json:"rider_phone"`
// 骑手手机号类型0是真实号1是隐私号
RiderPhoneType int32 `json:"rider_phone_type"`
// 骑手经度;骑手已接单/到店/取货/送达状态时必传;高德坐标系
RiderLongitude *string `json:"rider_longitude"`
// 骑手维度;骑手已接单/到店/取货/送达状态时必传;高德坐标系
RiderLatitude *string `json:"rider_latitude"`
// 骑手位置上报时间戳,传入骑手坐标时必填
ReportTime int64 `json:"report_time"`
// 状态更新时间戳
UpdateTime int64 `json:"update_time"`
// 取消原因
CancelReason *string `json:"cancel_reason"`
// 取消编码参考附件F01取消状态时必传
CancelCode *int64 `json:"cancel_code"`
// 运力状态枚举101:待骑手接单102:骑手已接单103:骑手已到店104:骑手已取货200:已送达300:已取消
Status int64 `json:"status"`
}

View File

@@ -0,0 +1,14 @@
package instantShopping_notifyDeliveryStatus_response
import (
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingNotifyDeliveryStatusResponse struct {
doudian_sdk.BaseDoudianOpApiResponse
Data *InstantShoppingNotifyDeliveryStatusData `json:"data"`
}
type InstantShoppingNotifyDeliveryStatusData struct {
// 抖音电商shop order单id
ShopOrderId string `json:"shop_order_id"`
}

View File

@@ -0,0 +1,66 @@
package instantShopping_reportRiderLocation_request
import (
"encoding/json"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_reportRiderLocation/response"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingReportRiderLocationRequest struct {
doudian_sdk.BaseDoudianOpApiRequest
Param *InstantShoppingReportRiderLocationParam
}
func (c *InstantShoppingReportRiderLocationRequest) GetUrlPath() string {
return "/instantShopping/reportRiderLocation"
}
func New() *InstantShoppingReportRiderLocationRequest {
request := &InstantShoppingReportRiderLocationRequest{
Param: &InstantShoppingReportRiderLocationParam{},
}
request.SetConfig(doudian_sdk.GlobalConfig)
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
return request
}
func (c *InstantShoppingReportRiderLocationRequest) Execute(accessToken *doudian_sdk.AccessToken) (*instantShopping_reportRiderLocation_response.InstantShoppingReportRiderLocationResponse, error) {
responseJson, err := c.GetClient().Request(c, accessToken)
if err != nil {
return nil, err
}
response := &instantShopping_reportRiderLocation_response.InstantShoppingReportRiderLocationResponse{}
_ = json.Unmarshal([]byte(responseJson), response)
return response, nil
}
func (c *InstantShoppingReportRiderLocationRequest) GetParamObject() interface{} {
return c.Param
}
func (c *InstantShoppingReportRiderLocationRequest) GetParams() *InstantShoppingReportRiderLocationParam {
return c.Param
}
type InstantShoppingReportRiderLocationParam struct {
// 抖音电商shop order单id
ShopOrderId string `json:"shop_order_id"`
// 三方运力服务商
DistributionCode string `json:"distribution_code"`
// 三方运单号
DistributionDeliveryId string `json:"distribution_delivery_id"`
// 骑手姓名;
RiderName string `json:"rider_name"`
// 骑手手机号类型0是真实号1是隐私号
RiderPhoneType int32 `json:"rider_phone_type"`
// 骑手电话;
RiderPhone string `json:"rider_phone"`
// 骑手经度,高德坐标系
RiderLongitude string `json:"rider_longitude"`
// 骑手维度,高德坐标系
RiderLatitude string `json:"rider_latitude"`
// 骑手上报时间戳
ReportTime int64 `json:"report_time"`
}

View File

@@ -0,0 +1,14 @@
package instantShopping_reportRiderLocation_response
import (
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
)
type InstantShoppingReportRiderLocationResponse struct {
doudian_sdk.BaseDoudianOpApiResponse
Data *InstantShoppingReportRiderLocationData `json:"data"`
}
type InstantShoppingReportRiderLocationData struct {
// 抖音电商shop order单id
ShopOrderId string `json:"shop_order_id"`
}

View File

@@ -7,8 +7,9 @@ import (
"testing"
)
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
var token1 = `{"access_token":"b27e1e5a-0e07-4311-b98b-69df26bbd82e","expires_in":1698285505,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"f6822620-4154-4a4a-b04e-7db30c08e7f9","authority_id":""}`
var token3 = `{"access_token":"6cf0af8c-8d96-4d20-b1e3-91187f31e694","expires_in":1698285505,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"69b9fd26-ff8a-48ab-ae50-b5241aa1ee03","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token1)
// 查询售后单详情
func TestAfsOrder(t *testing.T) {
@@ -17,8 +18,10 @@ func TestAfsOrder(t *testing.T) {
// 同意/拒绝售后单
func TestAggreOrNotAggreAfs(t *testing.T) {
a.AfterSaleOperate(int32(201), "7165706329204670732", "1", 0)
fmt.Println("11", 8|16|32|1)
var token1 = `{"access_token":"b27e1e5a-0e07-4311-b98b-69df26bbd82e","expires_in":1698285505,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"f6822620-4154-4a4a-b04e-7db30c08e7f9","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token1)
err := a.AfterSaleOperate(int32(201), "7293455053833322752", "1", 64270123)
fmt.Println(err)
}
func TestGetSkuDetailLocalID(t *testing.T) {

View File

@@ -10,7 +10,6 @@ import (
)
func TestApi(t *testing.T) {
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", "")
result, err := a.CreateToken("7cfe00c4-f8f0-4f93-992d-baeecd3bef5d")
globals.SugarLogger.Debugf("%v", utils.Format4Output(result, false))
globals.SugarLogger.Debugf("%v", utils.Format4Output(err, false))
@@ -63,8 +62,6 @@ func TestCreateExpss(t *testing.T) {
// 同意退货申请
func TestReturnGoodsToWareHouseSuccess(t *testing.T) {
token := `{"access_token":"60f530b2-9ab6-4723-b487-c094918f0d21","expires_in":1666257163,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"1220666a-5e88-458c-a8c0-06d949fbbd3f","authority_id":""}`
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
a.ReturnGoodsToWareHouseSuccess("7154200345302827303")
}
@@ -93,7 +90,7 @@ func TestOrderStatusAndPsInfo(t *testing.T) {
param["opcode"] = "DELIVERED"
param["courier_name"] = "刘磊"
param["courier_phone"] = "18981810340"
a.OrderStatusAndPsInfo(param)
a.OrderStatusAndPsInfoNew(param)
}
//

View File

@@ -3,12 +3,14 @@ package tiktok_api
import (
"encoding/json"
"errors"
instantShopping_notifyDeliveryStatus_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_notifyDeliveryStatus/request"
logistics_indTrackPush_reqeust "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/logistics_indTrackPush/request"
token_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/token_create/request"
token_create_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/token_create/response"
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"math"
"sync"
"time"
)
@@ -110,9 +112,9 @@ func (a *APIExpress) RefreshToken() (*doudian_sdk.CreateTokenData, error) {
return &createToken.Data, nil
}
// OrderStatusAndPsInfo 三方配送同步骑手位置信息
// OrderStatusAndPsInfoOld 三方配送同步骑手位置信息(老版本的运力回传)
// 抖音物流信息和抖音小时达完全区分开(这边的appKey和APPSecret完全不同于小时达)
func (a *APIExpress) OrderStatusAndPsInfo(param map[string]interface{}) error {
func (a *APIExpress) OrderStatusAndPsInfoOld(param map[string]interface{}) error {
// 组合参数
request := logistics_indTrackPush_reqeust.New()
psInfo := &logistics_indTrackPush_reqeust.LogisticsIndTrackPushParam{
@@ -164,3 +166,94 @@ func (a *APIExpress) OrderStatusAndPsInfo(param map[string]interface{}) error {
}
return nil
}
// OrderStatusAndPsInfoNew 三方配送同步骑手位置信息(新版本的运力回传)
// 抖音物流信息和抖音小时达完全区分开(这边的appKey和APPSecret完全不同于小时达)
func (a *APIExpress) OrderStatusAndPsInfoNew(param map[string]interface{}) error {
// 组合参数
request := instantShopping_notifyDeliveryStatus_request.New()
request.Param = &instantShopping_notifyDeliveryStatus_request.InstantShoppingNotifyDeliveryStatusParam{
ShopOrderId: param["order_id"].(string),
RiderPhoneType: 0,
ReportTime: time.Now().Unix(),
UpdateTime: time.Now().Unix(),
}
if param["courier_name"].(string) != "" {
request.Param.RiderName = utils.String2Pointer(param["courier_name"].(string))
}
if param["courier_phone"].(string) != "" {
request.Param.RiderPhone = utils.String2Pointer(param["courier_phone"].(string))
}
switch param["logistics_provider_code"].(string) {
case utils.DaDaCode:
request.Param.DistributionCode = TiktokDeliveryTypeDaDa
case utils.FnPsCode:
request.Param.DistributionCode = TiktokDeliveryTypeFengNiao
case utils.UUPTCode:
request.Param.DistributionCode = TiktokDeliveryTypeUU
case utils.SFPSCode:
request.Param.DistributionCode = TiktokDeliveryTypeSF
case utils.MTPsCode:
request.Param.DistributionCode = TiktokDeliveryTypeMeiTuan
case utils.MyselfPsCode:
request.Param.DistributionCode = TiktokDeliveryTypeMerchant
}
// 纬度
if param["latitude"].(string) != "" && param["longitude"].(string) != "" {
if len(param["latitude"].(string)) > len("39.978573") && len(param["longitude"].(string)) > len("116.5031060") { // 是否为百度坐标
lat, lng := AutoGaoDe2BaiDu(param["latitude"].(string), param["longitude"].(string))
request.Param.RiderLatitude = utils.String2Pointer(lat)
request.Param.RiderLongitude = utils.String2Pointer(lng)
} else {
request.Param.RiderLatitude = utils.String2Pointer(param["latitude"].(string))
request.Param.RiderLongitude = utils.String2Pointer(param["longitude"].(string))
}
}
if param["logistics_provider_code"].(string) != "MERCHANT" {
request.Param.DistributionDeliveryId = param["third_carrier_order_id"].(string)
}
switch param["opcode"].(string) {
case TiktokLogisticsStatusCALLRIDER:
request.Param.Status = 101
case TiktokLogisticsORDERRECEIVED:
request.Param.Status = 102
case TiktokLogisticsRIDERARRIVED:
request.Param.Status = 103
case TiktokLogisticsRIDERPICKUP:
request.Param.Status = 104
case TiktokLogisticsDELIVERED:
request.Param.Status = 200
case TiktokLogisticsCANCELDELIVERY, TiktokLogisticsINDDELIVERYEXCEPTION:
request.Param.Status = 300
request.Param.CancelCode = utils.Int64ToPointer(200) // 其他原因
request.Param.CancelReason = utils.String2Pointer("骑手未能到店,更换骑手") // 其他原因
}
if a.accessTokenObj == nil || a.accessTokenObj.CreateTokenData.AccessToken == "" {
a.CreateToken()
} else if a.expiresIn < time.Now().Unix() {
a.RefreshToken()
}
result, err := request.Execute(a.accessTokenObj)
if err != nil {
return err
}
if result.Code != RequestSuccessCode {
return errors.New(result.SubMsg + ":" + result.LogId)
}
return nil
}
func AutoGaoDe2BaiDu(lat, lon string) (string, string) {
x := utils.Str2Float64(lon) - 0.0065
y := utils.Str2Float64(lat) - 0.006
z := math.Sqrt(x*x+y*y) - 0.00002*math.Sin(y*math.Pi)
theta := math.Atan2(y, x) - 0.000003*math.Cos(x*math.Pi)
tempLon := z * math.Cos(theta)
tempLat := z * math.Sin(theta)
return utils.Float64ToStr(tempLat), utils.Float64ToStr(tempLon)
}

View File

@@ -19,6 +19,7 @@ import (
order_orderDetail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/response"
order_searchList_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_searchList/request"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"math"
"time"
)
@@ -114,7 +115,10 @@ func (a *API) AfterSaleOperate(refundType int32, refundId, remark string, storeI
return err
}
paramList.AftersaleId = refundId
paramList.Logistics.ReceiverAddressId = addressId
logistics := &afterSale_operate_request.Logistics{}
logistics.ReceiverAddressId = addressId
paramList.Logistics = logistics
refundListParam = append(refundListParam, paramList)
// 102拒绝退货申请一次审核 112拒绝退货 202拒绝仅退款 reason , evidence 302拒绝换货申请一次审核 312换货转退款
case AfterSaleEmuRefuseToReturnOneApply, AfterSaleEmuRefuseToReturnTwoApply, AfterSaleEmuRefuseOnlyRefundApply, AfterSaleEmuRefundChangeGoodsOneApply, AfterSaleEmuRefundChangeGoodsTwoApply:
@@ -325,6 +329,7 @@ func (a *API) CreateOrderCallback(orderStatus []byte) (map[string][]interface{},
if err := json.Unmarshal(orderStatus, &resp); err != nil {
return nil, &CallbackResponse{Code: CallbackFailCode, Msg: CallbackFail}
}
globals.SugarLogger.Debugf("============================resp:= %s", utils.Format4Output(resp, false))
callbackResult := make(map[string][]interface{}, 0)
for _, data := range resp {
@@ -461,6 +466,7 @@ func (a *API) CreateOrderCallback(orderStatus []byte) (map[string][]interface{},
if err := json.Unmarshal([]byte(data.Data), &create); err != nil {
return nil, CallbackResponseErr(false)
}
globals.SugarLogger.Debugf("============================data:= %s", utils.Format4Output(create, false))
callbackResult[CallbackShipmentInfoChange] = append(callbackResult[CallbackShipmentInfoChange], create)
default:
return nil, CallbackResponseErr(false)

View File

@@ -198,7 +198,6 @@ const (
)
// 商品审核状态: 1-未提交2-待审核3-审核通过4-审核未通过5-封禁7-审核通过待上架详见商品状态机https://op.jinritemai.com/docs/question-docs/92/2070
const (
SkuCheckStatusNotCommit = 1 // 未提交
SkuCheckStatusWaitCheck = 2 // 待审核
@@ -207,3 +206,24 @@ const (
SkuCheckStatusProhibit = 5 // 禁封
SkuCheckStatusPassNotPutOn = 7 // 通过待上架
)
const (
TiktokCancelCode201 = 201 // 超出配送范围
TiktokCancelCode203 = 203 // 运力紧张无可接单骑手
TiktokCancelCode204 = 204 // 骑手联系不上收货人
TiktokCancelCode208 = 208 // 商家未营业
TiktokCancelCode209 = 209 // 商家无法出餐
TiktokCancelCode210 = 210 // 商家地址错误
TiktokCancelCode211 = 211 // 用户拒收
TiktokCancelCode222 = 222 // 用户取消订单
TiktokCancelCode200 = 200 // 其他原因
)
const (
TiktokDeliveryTypeSF = "SF" //SF:顺丰同城
TiktokDeliveryTypeDaDa = "DADA" //DADA:达达
TiktokDeliveryTypeFengNiao = "FENG_NIAO" //FENG_NIAO:蜂鸟配送
TiktokDeliveryTypeMeiTuan = "MEI_TUAN" //MEI_TUAN:美团配送
TiktokDeliveryTypeUU = "UU" //UU:UU跑腿
TiktokDeliveryTypeMerchant = "MERCHANT" //MERCHANT:商家自配送,使用此枚举需要提前和平台沟通
)

View File

@@ -3,17 +3,29 @@ package tiktok_api
import (
"fmt"
order_getSettleBillDetailV3_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_getSettleBillDetailV3/request"
"strings"
"testing"
)
func TestBillDetail(t *testing.T) {
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
orderDetail, err := a.GetTiktokOrderDetail("6922140885578684202")
if err != nil {
fmt.Println(err)
}
a.GetSettleBillDetailV3(&order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param{
Size: 10,
OrderId: "6922140885578684202",
childrenOrderList := make([]string, 0, 0)
for _, v := range orderDetail.SkuOrderList {
childrenOrderList = append(childrenOrderList, v.OrderId)
}
date, datae, err := a.GetSettleBillDetailV3(&order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param{
Size: 20,
OrderId: strings.Join(childrenOrderList, ","),
})
fmt.Println(date)
fmt.Println(datae)
fmt.Println(err)
}
func TestLen(t *testing.T) {

View File

@@ -25,8 +25,6 @@ func TestGetRecommendCategory(t *testing.T) {
// "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VqGYBUaL_m_7457cda4c101d05bcd2a1258b61d2ba1_sx_223234_www800-800",
// //"https://p3-aio.ecombdimg.com/obj/ecom-shop-material/v1_GhxlaZ_70852585116381186630419_c55b8401b00e96e4114431a1dbd7c99c_sx_582346_www1000-1000",
//}
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
name := "广茄 "
data, err := a.GetRecommendCategoryByName(name)

View File

@@ -55,9 +55,6 @@ func TestGetSkuDetail(t *testing.T) {
// 查询商品详情本地商品id
func TestGetSkuDetailLocalId(t *testing.T) {
var token = `{"access_token":"90283046-8f2b-46cf-90f1-e522b229e784","expires_in":1697080460,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ae493f0f-97d8-43ca-9b0e-727480add1fa","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
data, err := a.GetSkuDetail("3592503538749683119", "")
fmt.Println(err)
globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false))
@@ -116,7 +113,6 @@ func TestEditStoreCommodity2(t *testing.T) {
// 解密购买用户电话,名字,地址
func TestBatchDecrypt(t *testing.T) {
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
orderID := "6919995408850359976"
order, err := a.GetTiktokOrderDetail(orderID)
if err != nil || order == nil {
@@ -138,30 +134,13 @@ func TestBatchDecrypt(t *testing.T) {
// a.OrderUserInfoSensitive("4988354190732430566")
//}
var c = []int64{
64208920}
//668851,
//668841,
//668711,
//668770,
//668709,
//668708,
//668713,
//668707,
//668712,running
//668710,running
//668714,running
//668723, ok
//668790, no
//668789, no
//668785, no
//668512, running
//667481, running
var c = []int64{64270123}
// 删除已经创建商品,重新同步
func TestDeleteSkuAndUploadSku(t *testing.T) {
var token = `{"access_token":"b27e1e5a-0e07-4311-b98b-69df26bbd82e","expires_in":1698285505,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"f6822620-4154-4a4a-b04e-7db30c08e7f9","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
var errList = make([]error, 0, 0)
for _, v := range c {
for i := 1; i < 100; i++ {

View File

@@ -88,9 +88,6 @@ func GetTiktokImgList(api *API, storeId, appOrgCode string, detailImg string, im
}
func TestRefundToken(t *testing.T) {
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
a.RefreshToken()
}

View File

@@ -510,8 +510,6 @@ func TestGetProvince(t *testing.T) {
// 仓库绑定门店
func TestBindWarehouseToStore(t *testing.T) {
token := `{"access_token":"a1746210-a8a3-4497-a87b-09d1f10dbb95","expires_in":1665652230,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"c1cf8d88-0983-4f2a-b969-3746fae6b0cd","authority_id":""}`
a := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token)
data, err := a.StoreBindWarehouse(&warehouse_bindStore_request.WarehouseBindStoreParam{
StoreIds: []int64{65312663},

View File

@@ -2,19 +2,21 @@ package tiktok_api
import (
"errors"
"fmt"
instantShopping_cancelDelivery_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_cancelDelivery/request"
instantShopping_createDelivery_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_createDelivery/request"
instantShopping_getDeliveryListByOrderId_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_getDeliveryListByOrderId/request"
instantShopping_getDeliveryListByOrderId_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_getDeliveryListByOrderId/response"
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_getStoreAutoCallRiderInfo_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getStoreAutoCallRiderInfo/request"
superm_getStoreAutoCallRiderInfo_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getStoreAutoCallRiderInfo/response"
superm_orderDispatcher_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/request"
superm_setStoreAutoCallRider_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_setStoreAutoCallRider/request"
"strings"
"git.rosy.net.cn/baseapi/utils"
)
// /superm/getDispatcherInfo 运力呼叫询价/运力取消询价(正向)
@@ -35,22 +37,47 @@ func (a *API) GetDispatcherInfo(storeID int64, shopOrderID string, dispatcherFee
return response.Data.DispatcherFee, nil
}
// /superm/shopOrderDispatcher 呼叫运力并发货/重新发货、取消运力
// ShopOrderDispatcher 取消运力,运力接口改版,取消和重新呼叫分开
func (a *API) ShopOrderDispatcher(storeID int64, shopOrderID string, dispatcherType int32) error {
request := superm_orderDispatcher_request.New()
request.Param = &superm_orderDispatcher_request.SupermOrderDispatcherParam{
StoreID: storeID,
ShopOrderID: shopOrderID,
DispatcherType: dispatcherType,
if dispatcherType == DispatcherFeeTypeCancel { // 取消运力
request := instantShopping_cancelDelivery_request.New()
request.Param = &instantShopping_cancelDelivery_request.InstantShoppingCancelDeliveryParam{
ShopOrderId: shopOrderID,
StoreId: storeID,
CancelCode: 0,
}
response, err := request.Execute(a.accessTokenObj)
if err != nil {
return err
}
if response.Code != RequestSuccessCode && response.Code != 90000 {
return errors.New(response.SubMsg + ":" + response.LogId)
}
return nil
} else if dispatcherType == DispatcherFeeTypeCall { // 呼叫运力
request := instantShopping_createDelivery_request.New()
request.Param = &instantShopping_createDelivery_request.InstantShoppingCreateDeliveryParam{
ShopOrderId: shopOrderID,
StoreId: storeID,
}
response, err := request.Execute(a.accessTokenObj)
if err != nil {
return err
}
if response.Code != RequestSuccessCode {
return errors.New(response.SubMsg + ":" + response.LogId)
}
return nil
}
response, err := request.Execute(a.accessTokenObj)
if err != nil {
return err
}
if response.Code != RequestSuccessCode {
return errors.New(response.SubMsg + ":" + response.LogId)
}
return nil
// 老版本
//request := superm_orderDispatcher_request.New()
//request.Param = &superm_orderDispatcher_request.SupermOrderDispatcherParam{
// StoreID: storeID,
// ShopOrderID: shopOrderID,
// DispatcherType: dispatcherType,
//}
return fmt.Errorf("抖音运力呼叫/取消type异常")
}
// /superm/setStoreAutoCallRider 订单自动呼叫运力 设置操作
@@ -132,35 +159,48 @@ func (a *API) ApplyPlatformPickUp(afterSaleID int64) (string, error) {
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,
// GetShipmentInfo 查询运力订单信息
func (a *API) GetShipmentInfo(shopOrderID, afterSaleID, shipmentType int64) (*instantShopping_getDeliveryListByOrderId_response.InstantShoppingGetDeliveryListByOrderIdData, error) {
request := instantShopping_getDeliveryListByOrderId_request.New()
request.Param = &instantShopping_getDeliveryListByOrderId_request.InstantShoppingGetDeliveryListByOrderIdParam{
ShopOrderId: utils.Int64ToStr(shopOrderID),
}
response, err := request.Execute(a.accessTokenObj)
if err != nil {
return nil, err
}
if strings.Contains(response.SubMsg, "订单不存在") || strings.Contains(response.SubMsg, "未找到当前物流订单, LO") {
return &superm_getShipmentInfo_response.ShipmentInfo{
ShopOrderID: shopOrderID,
AfterSaleID: 0,
TrackNo: "",
ShopID: 0,
ShipmentStatus: -1,
ShipmentError: 0,
RiderName: "",
RiderPhone: "",
RiderLongitude: "",
RiderLatitude: "",
OccurredTime: "",
}, nil
if response.Code != RequestSuccessCode {
return nil, errors.New(response.SubMsg + ":" + response.LogId)
}
return response.Data.ShipmentInfo, err
return response.Data, nil
//request := superm_getShipmentInfo_request.New()
//request.Param = &superm_getShipmentInfo_request.SupermGetShipmentInfoParam{
// ShopOrderID: shopOrderID,
// ShipmentType: shipmentType,
//}
//response, err := request.Execute(a.accessTokenObj)
//if err != nil {
// return nil, err
//}
//
//if strings.Contains(response.SubMsg, "订单不存在") || strings.Contains(response.SubMsg, "未找到当前物流订单, LO") {
// return &superm_getShipmentInfo_response.ShipmentInfo{
// ShopOrderID: shopOrderID,
// AfterSaleID: 0,
// TrackNo: "",
// ShopID: 0,
// ShipmentStatus: -1,
// ShipmentError: 0,
// RiderName: "",
// RiderPhone: "",
// RiderLongitude: "",
// RiderLatitude: "",
// OccurredTime: "",
// }, nil
//}
//
//return response.Data.ShipmentInfo, err
}
// /superm/cancelPlatformPickUp 取消运力 (逆向)

View File

@@ -1,6 +1,6 @@
package tiktok_api
const CallbackShipmentInfoChange = "12001" //小时达运力状态变更标识
const CallbackShipmentInfoChange = "15000" //小时达运力状态变更标识
const (
DispatcherFeeTypeCall = 1 //呼叫运力
@@ -23,15 +23,15 @@ const (
)
const (
ShipmentStatusCalling = 1
ShipmentStatusReceived = 2
ShipmentStatusArrived = 3
ShipmentStatusDelivering = 4
ShipmentStatusCalling = 101
ShipmentStatusReceived = 102
ShipmentStatusArrived = 103
ShipmentStatusDelivering = 104
ShipmentStatusRejected = 5
ShipmentStatusReturning = 6
ShipmentStatusReturned = 7
ShipmentStatusDelivered = 8
ShipmentStatusCanceled = 9
ShipmentStatusDelivered = 200
ShipmentStatusCanceled = 300
)
var ShipmentStatus = map[int64]string{
@@ -84,14 +84,23 @@ var ShipmentError = map[int]string{
//小时达运力状态变更消息体
type ShipmentInfoData struct {
AfterSaleID int64 `json:"aftersale_id"` //上门取运力对应售后单号
TrackNo string `json:"track_no"` //骑手配送运单号
RiderName string `json:"rider_name"` //骑手名称
RiderPhone string `json:"rider_phone"` //骑手电话
RiderLatitude string `json:"rider_latitude"` //骑手坐标纬度
RiderLongitude string `json:"rider_longitude"` //骑手坐标经度
ShopOrderID int64 `json:"shop_order_id"` //店铺订单号
ShopID int64 `json:"shop_id"` //抖店门店ID
ShipmentStatus int64 `json:"shipment_status"` //运状态
OccurredTime string `json:"occurred_time"` //当前状态变更时间
RiderPhone string `json:"rider_phone"` //骑手电话
RiderLng string `json:"rider_lng"` //骑手经度
RiderLat string `json:"rider_lat"` //骑手纬度
OperateTime string `json:"operate_time"` //状态变更时间
ShopID int64 `json:"shop_id"` //抖店门店ID
RiderName string `json:"rider_name"` //骑手名称
CancelCode int64 `json:"cancel_code"` //取消原因
ShopOrderID int64 `json:"shop_order_id"` //店铺订单号
Status int64 `json:"status"` //运状态
//AfterSaleID int64 `json:"aftersale_id"` //上门取运力对应售后单号
//TrackNo string `json:"track_no"` //骑手配送运单号
//RiderName string `json:"rider_name"` //骑手名称
//RiderPhone string `json:"rider_phone"` //骑手电话
//RiderLatitude string `json:"rider_latitude"` //骑手坐标纬度
//RiderLongitude string `json:"rider_longitude"` //骑手坐标经度
//ShopOrderID int64 `json:"shop_order_id"` //店铺订单号
//ShopID int64 `json:"shop_id"` //抖店门店ID
//ShipmentStatus int64 `json:"shipment_status"` //运单状态
//OccurredTime string `json:"occurred_time"` //当前状态变更时间
}

View File

@@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-print/globals"
"git.rosy.net.cn/jx-callback/globals"
"testing"
)
@@ -15,10 +15,24 @@ func TestGetDispatcherInfo(t *testing.T) {
fmt.Println(err)
}
func TestCancelWaybill(t *testing.T) {
err := a.ShopOrderDispatcher(64250755, "5030722721087718866", 2)
//token := `{"access_token":"6cf0af8c-8d96-4d20-b1e3-91187f31e694","expires_in":1698285505,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"69b9fd26-ff8a-48ab-ae50-b5241aa1ee03","authority_id":""}`
//var token = `{"access_token":"8a693254-f1e8-4427-b41f-6762a88fd53a","expires_in":1698285505,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"265c95d1-7c6b-407b-ab8c-2481c993480f","authority_id":""}`
var token = `{"access_token":"b27e1e5a-0e07-4311-b98b-69df26bbd82e","expires_in":1698285505,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"f6822620-4154-4a4a-b04e-7db30c08e7f9","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
err := a.ShopOrderDispatcher(75324142, "6922809843002512994", 2)
fmt.Println(err)
}
func TestGetShipmentInfo(t *testing.T) {
//var token = `{"access_token":"6cf0af8c-8d96-4d20-b1e3-91187f31e694","expires_in":1698285505,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"69b9fd26-ff8a-48ab-ae50-b5241aa1ee03","authority_id":""}`
var token = `{"access_token":"8a693254-f1e8-4427-b41f-6762a88fd53a","expires_in":1698285505,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"265c95d1-7c6b-407b-ab8c-2481c993480f","authority_id":""}`
var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token)
data, err := a.GetShipmentInfo(6922795601625880116, 0, ShipmentTypeInvoice)
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(err, false))
}
type tete struct {
ids []int64
name string
@@ -38,12 +52,6 @@ func Test(t *testing.T) {
fmt.Println(50|2, 3|2)
}
func TestGetShipmentInfo(t *testing.T) {
data, err := a.GetShipmentInfo(6922112012008166892, 0, ShipmentTypeInvoice)
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(data, false))
globals.SugarLogger.Debugf("======data := %s", utils.Format4Output(err, false))
}
func TestGetStoreAutoCallRiderInfo(t *testing.T) {
a.GetStoreAutoCallRiderInfo(64212030)
}

View File

@@ -0,0 +1,5 @@
package tiktok_api
func (a *API) CancelDelivery() {
}

View File

@@ -16,7 +16,7 @@ type RiderInfo struct {
ThirdCarrierOrderId string `json:"third_carrier_order_id"` // 京西平台id(运单id)
CourierName string `json:"courier_name"` // 骑手名称
CourierPhone string `json:"courier_phone"` // 骑手电话
LogisticsProviderCode string `json:"logistics_provider_code"` // 配送平台code 10001-顺丰, 10002-达达, 10003-闪送, 10004-蜂鸟, 10005 UU跑腿,10006 快跑者, 10007 极客快送,10008-点我达,10009 同达, 10010-生活半径,10011 邻趣,10012 趣送, 10013 快服务 10014 菜鸟新配盟 10015 商家自建配送 10016 风先生,10017-其他,10018-抖音配送(小时达),10032-美团跑腿
LogisticsProviderCode string `json:"logistics_provider_code"` // 配送平台code
LogisticsStatus int `json:"logistics_status"` // 配送状态(美团用)
LogisticsContext string `json:"logistics_context"` // 配送状态描述
Latitude string `json:"latitude"` // 骑手当前的纬度,美团使用的是高德坐标系。