diff --git a/platformapi/tiktok_shop/sdk-golang/api/product_detail_out_productId/request/product_detail_request.go b/platformapi/tiktok_shop/sdk-golang/api/product_detail_out_productId/request/product_detail_request.go index 1ffeb00f..1c811a46 100644 --- a/platformapi/tiktok_shop/sdk-golang/api/product_detail_out_productId/request/product_detail_request.go +++ b/platformapi/tiktok_shop/sdk-golang/api/product_detail_out_productId/request/product_detail_request.go @@ -46,9 +46,11 @@ func (c *ProductDetailOutRequest) GetParams() *ProductDetailParamOutProductId { type ProductDetailParamOutProductId struct { // 商品ID,抖店系统生成,店铺下唯一;长度19位。 - //ProductId string `json:"product_id"` + ProductId string `json:"product_id"` // 外部商家编码,商家自定义字段 OutProductId string `json:"out_product_id"` + // 门店id + StoreId int64 `json:"store_id"` //// true:读取草稿数据;false:读取线上数据;不传默认为false //ShowDraft string `json:"show_draft"` } diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index ae6ea9b9..2524dfa3 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -7,9 +7,12 @@ import ( "testing" ) +// 京西速食(蔬菜) 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) + +// 京西到家(商超) +var token2 = `{"access_token":"7e3853fa-24d4-4649-938b-46947da04c92","expires_in":1698887957,"scope":"SCOPE","shop_id":68023619,"shop_name":"京西到家","refresh_token":"1dd634e9-9f9e-459b-a770-341fb64e4f88","authority_id":""}` +var a = New("7267745202649957900", "51998fcf-d521-4553-8c0c-fa662c8dbd6e", token2) // 查询售后单详情 func TestAfsOrder(t *testing.T) { @@ -18,8 +21,6 @@ func TestAfsOrder(t *testing.T) { // 同意/拒绝售后单 func TestAggreOrNotAggreAfs(t *testing.T) { - 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) } diff --git a/platformapi/tiktok_shop/tiktok_api/api_test.go b/platformapi/tiktok_shop/tiktok_api/api_test.go index 590958aa..1aca5812 100644 --- a/platformapi/tiktok_shop/tiktok_api/api_test.go +++ b/platformapi/tiktok_shop/tiktok_api/api_test.go @@ -82,15 +82,15 @@ func TestOrderStatusAndPsInfo(t *testing.T) { //appKey := `7152420904331429407` // 暂时定死 //appSecret := `cc7ba367-2394-4cbb-81c6-26f0e929d1c6` //暂时定死 token := `{"access_token":"4a543151-f8fd-43d5-9c34-d19fe11fc51c","expires_in":1694069036,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"5a2aaca1-42f7-4b83-9358-8ed5d1d4bcd6","authority_id":""}` - a := NewExpress("7152420904331429407", "cc7ba367-2394-4cbb-81c6-26f0e929d1c6", token) - a.CreateToken() + a2 := NewExpress("7152420904331429407", "cc7ba367-2394-4cbb-81c6-26f0e929d1c6", token) + a2.CreateToken() param := make(map[string]interface{}, 0) param["third_carrier_order_id"] = "6921428072500696298" param["logistics_context"] = "JIEDAN" param["opcode"] = "DELIVERED" param["courier_name"] = "刘磊" param["courier_phone"] = "18981810340" - a.OrderStatusAndPsInfoNew(param) + a2.OrderStatusAndPsInfoNew(param) } // diff --git a/platformapi/tiktok_shop/tiktok_api/sku.go b/platformapi/tiktok_shop/tiktok_api/sku.go index 7fb35163..0addde37 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku.go +++ b/platformapi/tiktok_shop/tiktok_api/sku.go @@ -303,13 +303,11 @@ func (a *API) GetSkuDetail(productId, outProductId string) (*product_detail_resp } // GetSkuDetailLocalID 查询单个商品详情(这个只有京西平台商品id有效,查询到的商品可能为子商品也可能为主商品,主商品删除时,子商品和主商品状态不一致) -func (a *API) GetSkuDetailLocalID(productId, outProductId string) (*product_detail_response.ProductDetailData, error) { +func (a *API) GetSkuDetailLocalID(vendorStoreId, outProductId string) (*product_detail_response.ProductDetailData, error) { request := product_detail_request_out.New() param := request.GetParams() - - if outProductId != "" { - param.OutProductId = outProductId - } + param.OutProductId = outProductId + param.StoreId = utils.Str2Int64(vendorStoreId) result, err := request.Execute(a.accessTokenObj) if strings.Contains(result.SubMsg, "未找到或商品已删除") { diff --git a/platformapi/tiktok_shop/tiktok_api/sku_test.go b/platformapi/tiktok_shop/tiktok_api/sku_test.go index 2a5c7ac9..fe7d5ded 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_test.go @@ -47,7 +47,7 @@ func TestInt16(t *testing.T) { // 查询商品详情(抖音平台id) func TestGetSkuDetail(t *testing.T) { - data, err := a.GetSkuDetailLocalID("", "25078") + data, err := a.GetSkuDetailLocalID("131006464", "33665") fmt.Println(err) // 3582171870197365727 3582171870197365727 globals.SugarLogger.Debugf("====%s", utils.Format4Output(data, false)) @@ -126,21 +126,10 @@ func TestBatchDecrypt(t *testing.T) { fmt.Println(err) } -//// 脱敏购买用户电话,名字,地址 -//func TestOrderUserInfoSensitive(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.OrderUserInfoSensitive("4988354190732430566") -//} - -var c = []int64{86794412} +var c = []int64{131006464} // 删除已经创建商品,重新同步 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++ { diff --git a/platformapi/tiktok_shop/tiktok_api/store_test.go b/platformapi/tiktok_shop/tiktok_api/store_test.go index a74766e3..54c69e23 100644 --- a/platformapi/tiktok_shop/tiktok_api/store_test.go +++ b/platformapi/tiktok_shop/tiktok_api/store_test.go @@ -31,9 +31,6 @@ import ( "time" ) -var token2 = `{"access_token":"26a0ee33-fca9-4b80-980a-3d6cf48ca159","expires_in":1678656378,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ef12dcb4-766d-4e6b-905d-448a25279431","authority_id":""}` -var api2 = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token2) - //创建店铺 func TestCreateStore(t *testing.T) { @@ -576,7 +573,7 @@ func TryUnmarshalUseNumber(data []byte, result interface{}) error { } func TestGetStoreFreightDetail(t *testing.T) { - detail, err := api2.GetStoreFreightDetail(25370494) + detail, err := a.GetStoreFreightDetail(25370494) fmt.Println(utils.Format4Output(detail, false)) fmt.Println(err) } diff --git a/platformapi/tiktok_shop/tiktok_api/transport_test.go b/platformapi/tiktok_shop/tiktok_api/transport_test.go index 6579e7e1..bfdb07bc 100644 --- a/platformapi/tiktok_shop/tiktok_api/transport_test.go +++ b/platformapi/tiktok_shop/tiktok_api/transport_test.go @@ -15,19 +15,11 @@ func TestGetDispatcherInfo(t *testing.T) { fmt.Println(err) } func TestCancelWaybill(t *testing.T) { - //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)) @@ -38,20 +30,6 @@ type tete struct { name string } -func Test(t *testing.T) { - //var b interface{} - //x := reflect.TypeOf(b) - //fmt.Println(reflect.TypeOf(a) == reflect.TypeOf([]int64{})) - //switch x { - //case reflect.TypeOf([]int64{}): - // fmt.Println(1) - //case reflect.TypeOf([]string{}): - // fmt.Println(2) - //} - fmt.Println(50&2, 3&2) - fmt.Println(50|2, 3|2) -} - func TestGetStoreAutoCallRiderInfo(t *testing.T) { a.GetStoreAutoCallRiderInfo(64212030) }