diff --git a/platformapi/mtpsapi/riderInfo.go b/platformapi/mtpsapi/riderInfo.go index d493764c..aefe9c7d 100644 --- a/platformapi/mtpsapi/riderInfo.go +++ b/platformapi/mtpsapi/riderInfo.go @@ -4,6 +4,7 @@ const ( DaDaCode = "10002" // 达达配送 FnPsCode = "10004" // 蜂鸟配送 MTPsCode = "10032" // 美团配送 + DYPsCode = "10018" //抖音配送(小时达) MyselfPsCode = "10015" // 自送 ) @@ -12,7 +13,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-其他,10032-美团跑腿 + 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-美团跑腿 LogisticsStatus int `json:"logistics_status"` // 配送状态(美团用) LogisticsContext string `json:"logistics_context"` // 配送状态描述 Latitude string `json:"latitude"` // 骑手当前的纬度,美团使用的是高德坐标系。 diff --git a/platformapi/mtwmapi/retail_test.go b/platformapi/mtwmapi/retail_test.go index ecfe6053..c7d72575 100644 --- a/platformapi/mtwmapi/retail_test.go +++ b/platformapi/mtwmapi/retail_test.go @@ -3,7 +3,11 @@ package mtwmapi import ( "errors" "fmt" +<<<<<<< HEAD "git.rosy.net.cn/jx-callback/globals" +======= + "git.rosy.net.cn/baseapi/utils/errlist" +>>>>>>> 85884e9932497f156e47da04db8229b88cf36e23 "testing" "git.rosy.net.cn/baseapi/utils" @@ -29,21 +33,22 @@ func TestRetailCatUpdate(t *testing.T) { } } func TestRetailCatDelete(t *testing.T) { - //var err error - //errList := errlist.New() - //info := []string{"11309161", "7379027", "14422863", "12405467", "12398353", "12422620", "12422751", "11437415", "2391979", "11037873", "11646173", "12286931", "11086818", "9000444", "13413407", "10874383", "11674367", "11824223", "11939392", "11810047", "12071134", "11799045", "12848707", "11596643", "14038247", "9676866", "15382980", "8967897", "11566485", "11774697", "11730687", "11798089", "11488932", "11651698", "11637939", "11831005", "11883106", "11011885", "11342761", "12131910", "12833849", "11209533", "12211457", "15874713", "11440630", "12665305", "11437682", "11440628", "9578183", "11796739", "11213162", "12665208", "13887316"} - //str := []string{"token_gFkmTBCfctlpehYTENBNpw", "token_tnrjZftD5q4lU42KI3RPsQ", "token_ih9ZUCueA_dnrHBC6eBDew", "token_uJenwb2m6hWDe36e7hhAuw", "token_o2bWH171jXW8dIikHjFFog", "token_kfsqhhQ3kPXAwxUueglF_g", "token_h86ZqAP89I-Pe6vMACVLZQ", "token_uzWsBdnSIbv1KBQPoNRKRQ", "token_ucnSaUtKiUbonBnax5dDMQ", "token_o2-KGSi8lbh1ON4seUlEiQ", "token_v0gPiP4rH1vrS51GXgZJBg", "token_k0GWFzpjDtodAW5yFhVBgA", "token_oV2lXBnc1d8kc_JgWvtFxQ", "token_gl5GkKf9XKOO5ZNK-0JPRg", "token_suOF8ngaSTOcFcjNxvdHVA", "token_nf9QokI2udnECY2s1zBIeA", "token_nZjY3PlhFWlkHxdUDr9EsA", "token_kwq5HiBJI4vnavnmDyZBuA", "token_jhE-_ku5e7g6Ys4jWt5J0g", "token_lqAjjKmpEws1pKcspd1ETw", "token_mj31nyxnSIKFfxjViWpN4w", "token_kxjANA3lKNqfJrXApsZEEg", "token_kMttVFAYWLAcPAmZi3FNjg", "token_gd5aruWWQX2Iz8CXEg1Gaw", "token_j1HkNiZHh76aEGLqJT9Pfw", "token_muEkyBPPm6quxE2P2dlNQA", "token_uoHU5jcIZNx_QV0rZI1Now", "token_jj9M4B67tEr0DKgRiidDBQ", "token_gXpPtzRin_m9SEzohBJOFA", "token_rBIwyLoU2O6qfq2_VCdBQg", "token_qY6wArUbm8ypW1IoUc5Frw", "token_m5XZKS8TiL1ILCqy1flFjg", "token_n5xs7bSk96MekhNxWuJGPw", "token_oqbTOzEAZYvr4QgRIypA9w", "token_jmBHMy8LQi-TPa1fOsJJKQ", "token_nNzvPUZFeQ009kWinAhDiw", "token_q4EqYUsEXy726qXH1fdJeA", "token_o0aHQxC55_XjOLvWuYFFCQ", "token_k9vJhV8aAX2fN-39KZRGEA", "token_vdGAQ50zMvm_Ofqz1yJJwg", "token_r-XGhX8HFahkkDMelHxFbQ", "token_nHupX9FsP6nj6HWQm0RN2w", "token_hpNdSt3m1Hs-CKAiWZlMKw", "token_mQ16KE4knE2sdPP2r8ROSw", "token_uUrPsYavDU1ExUwEbuFG8Q", "token_oSSLl9h6zIt9hKz16e1N_g", "token_ifyMH0B_2YipwaBoBmdAdQ", "token_uryS4endUdFgySqEWo9Dwg", "token_kAFq-IIr_5KYQwo5wlhPcg", "token_shBMfRfZtOS1xaNn5MdI0Q", "token_sS0KoWshUu-WlGchoxBNcA"} - //for _, v := range info { - // for _, i := range str { - // err = New("5873", "41c479790a76f86326f89e8048964739", "", i).RetailCatDelete(v, "", "国产水果") - // if err != nil { - // errList.AddErr(err) - // } - // } - //} + var err error + errList := errlist.New() + info := []string{"11309161", "16227684", "7379027", "14422863", "16194618", "12405467", "12398353", "12422620", "12422751", "11437415", "2391979", "11037873", "11646173", "16126553", "12286931", "11086818", "9000444", "13413407", "10874383", "11674367", "11824223", "11939392", "11810047", "12071134", "16336571", "11799045", "12848707", "11596643", "14038247", "9676866", "15382980", "8967897", "11566485", "11774697", "11730687", "11798089", "11488932", "11651698", "11637939", "11831005", "11883106", "11011885", "11342761", "12131910", "12833849", "11209533", "16034387", "12211457", "11440630", "12665305", "11440628", "9578183", "11213162", "12665208", "13887316", "16218203"} + str := []string{"token_l69jtloeNOyfYoIv5vtAqA", "token_sPpMgp5WrqH--3oUPf5A2Q", "token_mqXPXS__T45VI3WK8iRGyA", "token_h_0MbgOUqP1zu1lQUoVLVA", "token_nRk9S74kkyAmJwnHUnNNTQ", "token_g04eYyajpFtB7z3ZIPhEgQ", "token_ji6aHTKAttUr5HpG-P1ILw", "token_iVA8HCqCw25WKAYAeoxI6w", "token_nZ7wvaGrgCKo_9eEGWpFhQ", "token_g0nXxm1y_b3WG-869uFHvQ", "token_mNksHDmG0qmuan9X2PNAXg", "token_nzqieSpknIntGYVnSctCyg", "token_jheBN1obUU6mCB6u93FBzA", "token_pCpFSUwf_57qrxGpXdNGWw", "token_rt3u9NYfIK5Fw7vCCjJI_A", "token_tcwAXxe5Y6vkZfWiV5pCVA", "token_gEUkpazta411uA4AoSNOzA", "token_ohaUdeTfmvdSD7UCNqNDXw", "token_nf9QokI2udnECY2s1zBIeA", "token_qSg63aT-Wt6BYgOO8r9MpQ", "token_jRfqTEHnchVH8-3SBzRD-Q", "token_hSw6aphyuATaU1524PpAog", "token_gpkQ3am3MIjtmL3WIp9LIQ", "token_v6p8GXKDXG64Mz9d6SlJ8g", "token_mVsCcR9Knd776UkwrqZCfg", "token_uN6yb9hg2L58Z_eI04hPZA", "token_smMsR19Ib6u5LEtkcpZIRw", "token_pJdrB68qBrJu_DAkEMNGow", "token_oE0SITdA7dSlT-yfVpdHqQ", "token_sT9UC1PA7yGF0i_ZN-9LKA", "token_ifEUVfiOnCWSkRH7uBpEKA", "token_lAH8mmNcd4FMrRNI4PhNgg", "token_r2KorM-YOndp3WD2icRNXA", "token_ukvP9JmDe8kzKvn2lP9HhA", "token_jN00JUjbTA7mHouHgHJD_w", "token_jF9quf44XfZLd89ew_xIDQ", "token_neBnndby2RbQ3YDmitxELw", "token_gOyTabNAYD_8kO7D3rJH4A", "token_nH7t8V0ib82ZMZyT0N1EzA", "token_mWp3EsfRBKnIZVIvq99Iww", "token_saH3wIiaXWHrEp1BYd9O5A", "token_g2RPkuiaJpB5FL93aSdL0Q", "token_pWOdbMFUxVw9rMKaeMRCAA", "token_hNc_xjRPdCiemK1YzwJBnQ", "token_kZj0G0WN5ggEbrBf-vtLSA", "token_jdfG0c3LmJL2_PZO8u1DTA", "token_r8Rll9OBeGP86Arp409AyQ", "token_kpxTu56s_wdcXbkvTOJIBA", "token_saPyD06boPCm9T7C2o9Htw", "token_uQQTtEL2oqlR5G5rQ_NHkQ", "token_k8JY5o5eR-GyxZTEH0pLBQ", "", "token_qNnnfVJweCf6Cv-wqNdJlg", "token_hVQ5K6FcX-gkRXVNLplPvA", "", "token_rq2dpLklomhaQA78qH1LMQ"} + for _, v := range info { + for _, i := range str { + err = New("5873", "41c479790a76f86326f89e8048964739", "", i).RetailCatDelete(v, "", "热销") + if err != nil { + errList.AddErr(err) + } + } + } + fmt.Printf("errList==============%s", errList) //t.Fatal(errList) - err := api.RetailCatDelete("8694203", "" /*utils.GetUpperUUID()*/, "国产水果") - t.Fatal(err) + //err := api.RetailCatDelete("8694203", "" /*utils.GetUpperUUID()*/, "国产水果") + //t.Fatal(err) } func TestRetailList(t *testing.T) { diff --git a/platformapi/tiktok_shop/sdk-golang/api/superm_cancelPlatformPickUp/response/superm_cancelPlatformPickUp_response.go b/platformapi/tiktok_shop/sdk-golang/api/superm_cancelPlatformPickUp/response/superm_cancelPlatformPickUp_response.go index 7ef8ac87..4701f982 100644 --- a/platformapi/tiktok_shop/sdk-golang/api/superm_cancelPlatformPickUp/response/superm_cancelPlatformPickUp_response.go +++ b/platformapi/tiktok_shop/sdk-golang/api/superm_cancelPlatformPickUp/response/superm_cancelPlatformPickUp_response.go @@ -4,8 +4,8 @@ import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/c type SupermCancelPlatformPickUpResponse struct { doudian_sdk.BaseDoudianOpApiResponse - Data *SupermCancelPlatformPickUpResponseData `json:"data"` + Data *SupermCancelPlatformPickUpData `json:"data"` } -type SupermCancelPlatformPickUpResponseData struct { +type SupermCancelPlatformPickUpData struct { } diff --git a/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/request/superm_createVirtualMobile_request.go b/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/request/superm_createVirtualMobile_request.go new file mode 100644 index 00000000..289077eb --- /dev/null +++ b/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/request/superm_createVirtualMobile_request.go @@ -0,0 +1,49 @@ +package superm_createVirtualMobile_request + +import ( + "encoding/json" + superm_createVirtualMobile_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response" + doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core" +) + +type SupermCreateVirtualMobileRequest struct { + doudian_sdk.BaseDoudianOpApiRequest + Param *SupermOrderDispatcherParam +} + +func (c *SupermCreateVirtualMobileRequest) GetUrlPath() string { + return "/superm/createVirtualMobile" +} + +func New() *SupermCreateVirtualMobileRequest { + request := &SupermCreateVirtualMobileRequest{ + Param: &SupermOrderDispatcherParam{}, + } + request.SetConfig(doudian_sdk.GlobalConfig) + request.SetClient(doudian_sdk.DefaultDoudianOpApiClient) + return request + +} + +func (c *SupermCreateVirtualMobileRequest) Execute(accessToken *doudian_sdk.AccessToken) (*superm_createVirtualMobile_response.SupermCreateVirtualMobileResponse, error) { + responseJson, err := c.GetClient().Request(c, accessToken) + if err != nil { + return nil, err + } + response := &superm_createVirtualMobile_response.SupermCreateVirtualMobileResponse{} + _ = json.Unmarshal([]byte(responseJson), response) + return response, nil + +} + +func (c *SupermCreateVirtualMobileRequest) GetParamObject() interface{} { + return c.Param +} + +func (c *SupermCreateVirtualMobileRequest) GetParams() *SupermOrderDispatcherParam { + return c.Param +} + +type SupermOrderDispatcherParam struct { + ShopOrderID int64 `json:"shopOrderID"` //店铺父订单号 +} diff --git a/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response/superm_createVirtualMobile_response.go b/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response/superm_createVirtualMobile_response.go new file mode 100644 index 00000000..267e7da8 --- /dev/null +++ b/platformapi/tiktok_shop/sdk-golang/api/superm_createVirtualMobile/response/superm_createVirtualMobile_response.go @@ -0,0 +1,17 @@ +package superm_createVirtualMobile_response + +import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core" + +type SupermCreateVirtualMobileResponse struct { + doudian_sdk.BaseDoudianOpApiResponse + Data *SupermCreateVirtualMobileData `json:"data"` +} + +type MobileInfo struct { + IsNewCreate bool `json:"isNewCreate"` //是否新创建的 + MobileVirtual string `json:"mobileVirtual"` //虚拟号值 + ExpireTime string `json:"expireTime"` //过期时间 格式为yyyy-MM-dd HH:mm:ss 2016-01-01 12:00:00 +} +type SupermCreateVirtualMobileData struct { + MobileInfo *MobileInfo `json:"mobileInfo"` //虚拟隐私小号信息 +} diff --git a/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/request/superm_getDispatcherInfo_request.go b/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/request/superm_getDispatcherInfo_request.go new file mode 100644 index 00000000..f4b35a69 --- /dev/null +++ b/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/request/superm_getDispatcherInfo_request.go @@ -0,0 +1,51 @@ +package superm_getDispatcherInfo_request + +import ( + "encoding/json" + superm_getDispatcherInfo_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/response" + doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core" +) + +type SupermGetDispatcherInfoRequest struct { + doudian_sdk.BaseDoudianOpApiRequest + Param *SupermGetDispatcherInfoParam +} + +func (c *SupermGetDispatcherInfoRequest) GetUrlPath() string { + return "/superm/getDispatcherInfo" +} + +func New() *SupermGetDispatcherInfoRequest { + request := &SupermGetDispatcherInfoRequest{ + Param: &SupermGetDispatcherInfoParam{}, + } + request.SetConfig(doudian_sdk.GlobalConfig) + request.SetClient(doudian_sdk.DefaultDoudianOpApiClient) + return request + +} + +func (c *SupermGetDispatcherInfoRequest) Execute(accessToken *doudian_sdk.AccessToken) (*superm_getDispatcherInfo_response.SupermGetDispatcherInfoResponse, error) { + responseJson, err := c.GetClient().Request(c, accessToken) + if err != nil { + return nil, err + } + response := &superm_getDispatcherInfo_response.SupermGetDispatcherInfoResponse{} + _ = json.Unmarshal([]byte(responseJson), response) + return response, nil + +} + +func (c *SupermGetDispatcherInfoRequest) GetParamObject() interface{} { + return c.Param +} + +func (c *SupermGetDispatcherInfoRequest) GetParams() *SupermGetDispatcherInfoParam { + return c.Param +} + +type SupermGetDispatcherInfoParam struct { + StoreID int64 `json:"storeID"` + ShopOrderID int64 `json:"shopOrderID"` + DispatcherType int32 `json:"dispatcherType"` +} diff --git a/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/response/superm_getDispatcherInfo_response.go b/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/response/superm_getDispatcherInfo_response.go new file mode 100644 index 00000000..964a4b22 --- /dev/null +++ b/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/response/superm_getDispatcherInfo_response.go @@ -0,0 +1,12 @@ +package superm_getDispatcherInfo_response + +import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core" + +type SupermGetDispatcherInfoResponse struct { + doudian_sdk.BaseDoudianOpApiResponse + Data *SupermGetDispatcherInfoData `json:"data"` +} + +type SupermGetDispatcherInfoData struct { + DispatcherFee int64 `json:"dispatcherFee"` //呼叫运力费用,单位 分 +} diff --git a/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/request/superm_orderDispatcher_resuest.go b/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/request/superm_orderDispatcher_resuest.go new file mode 100644 index 00000000..ab06620a --- /dev/null +++ b/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/request/superm_orderDispatcher_resuest.go @@ -0,0 +1,51 @@ +package superm_orderDispatcher_request + +import ( + "encoding/json" + superm_getDispatcherInfo_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/superm_getDispatcherInfo/response" + doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core" +) + +type SupermOrderDispatcherRequest struct { + doudian_sdk.BaseDoudianOpApiRequest + Param *SupermOrderDispatcherParam +} + +func (c *SupermOrderDispatcherRequest) GetUrlPath() string { + return "/superm/orderDispatcher" +} + +func New() *SupermOrderDispatcherRequest { + request := &SupermOrderDispatcherRequest{ + Param: &SupermOrderDispatcherParam{}, + } + request.SetConfig(doudian_sdk.GlobalConfig) + request.SetClient(doudian_sdk.DefaultDoudianOpApiClient) + return request + +} + +func (c *SupermOrderDispatcherRequest) Execute(accessToken *doudian_sdk.AccessToken) (*superm_getDispatcherInfo_response.SupermGetDispatcherInfoResponse, error) { + responseJson, err := c.GetClient().Request(c, accessToken) + if err != nil { + return nil, err + } + response := &superm_getDispatcherInfo_response.SupermGetDispatcherInfoResponse{} + _ = json.Unmarshal([]byte(responseJson), response) + return response, nil + +} + +func (c *SupermOrderDispatcherRequest) GetParamObject() interface{} { + return c.Param +} + +func (c *SupermOrderDispatcherRequest) GetParams() *SupermOrderDispatcherParam { + return c.Param +} + +type SupermOrderDispatcherParam struct { + StoreID int64 `json:"storeID"` + ShopOrderID int64 `json:"shopOrderID"` + DispatcherType int32 `json:"dispatcherType"` +} diff --git a/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/response/superm_orderDispatcher_response.go b/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/response/superm_orderDispatcher_response.go new file mode 100644 index 00000000..554de902 --- /dev/null +++ b/platformapi/tiktok_shop/sdk-golang/api/superm_orderDispatcher/response/superm_orderDispatcher_response.go @@ -0,0 +1,12 @@ +package superm_orderDispatcher_response + +import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core" + +type SupermOrderDispatcherResponse struct { + doudian_sdk.BaseDoudianOpApiResponse + Data *SupermOrderDispatcherData `json:"data"` +} + +type SupermOrderDispatcherData struct { + DispatcherFee int64 `json:"dispatcherFee"` //呼叫运力费用 +} diff --git a/platformapi/tiktok_shop/tiktok_api/order.go b/platformapi/tiktok_shop/tiktok_api/order.go index 0d02b024..3476849b 100644 --- a/platformapi/tiktok_shop/tiktok_api/order.go +++ b/platformapi/tiktok_shop/tiktok_api/order.go @@ -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) } diff --git a/platformapi/tiktok_shop/tiktok_api/transport.go b/platformapi/tiktok_shop/tiktok_api/transport.go index ba80e642..ab73188d 100644 --- a/platformapi/tiktok_shop/tiktok_api/transport.go +++ b/platformapi/tiktok_shop/tiktok_api/transport.go @@ -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, diff --git a/platformapi/tiktok_shop/tiktok_api/transport_model.go b/platformapi/tiktok_shop/tiktok_api/transport_model.go index cb01df15..db749d3b 100644 --- a/platformapi/tiktok_shop/tiktok_api/transport_model.go +++ b/platformapi/tiktok_shop/tiktok_api/transport_model.go @@ -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"` //当前状态变更时间 +} diff --git a/platformapi/tiktok_shop/tiktok_api/transport_test.go b/platformapi/tiktok_shop/tiktok_api/transport_test.go new file mode 100644 index 00000000..7d3317fb --- /dev/null +++ b/platformapi/tiktok_shop/tiktok_api/transport_test.go @@ -0,0 +1,8 @@ +package tiktok_api + +import "testing" + +//运力呼叫询价(正向) +func TestGetDispatcherInfo(t *testing.T) { + //dispatcherFee, err := a.GetDispatcherInfo() +}