diff --git a/platformapi/mtwmapi/retail_test.go b/platformapi/mtwmapi/retail_test.go index 184e3d2a..baa4e42b 100644 --- a/platformapi/mtwmapi/retail_test.go +++ b/platformapi/mtwmapi/retail_test.go @@ -294,6 +294,11 @@ func TestRetailInitData(t *testing.T) { for { // 同步商品 fromFoodList, err1 := api.RetailListAll("21494359", i) + for _, v := range fromFoodList { + if v.AppFoodCode == "mtcode_1902626039134900287" { + fmt.Println(v) + } + } if len(fromFoodList) == 0 || fromFoodList == nil { fmt.Println(fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i)) return diff --git a/platformapi/tiktok_shop/tiktok_api/sku.go b/platformapi/tiktok_shop/tiktok_api/sku.go index f7605f13..2cf03ec7 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku.go +++ b/platformapi/tiktok_shop/tiktok_api/sku.go @@ -142,7 +142,11 @@ func (a *API) BatchGetChannelCategoryMapping(categoryIds []int64) (map[int64]int mappingData := make(map[int64]int64, 0) for _, v := range result.Data.RespItems { - mappingData[v.SourceCategoryId] = v.CategoryMappings[0].MappingCategoryId + if len(v.CategoryMappings) == 0 { + mappingData[v.SourceCategoryId] = 0 + } else { + mappingData[v.SourceCategoryId] = v.CategoryMappings[0].MappingCategoryId + } } return mappingData, nil diff --git a/platformapi/tiktok_shop/tiktok_api/sku_test.go b/platformapi/tiktok_shop/tiktok_api/sku_test.go index c85f9c55..fd786dd7 100644 --- a/platformapi/tiktok_shop/tiktok_api/sku_test.go +++ b/platformapi/tiktok_shop/tiktok_api/sku_test.go @@ -32,7 +32,58 @@ func TestGetRecommendCategoryByName(t *testing.T) { } func TestBatchGetChannelCategoryMapping(t *testing.T) { - items, err := a.BatchGetChannelCategoryMapping(nil) + items, err := a.BatchGetChannelCategoryMapping([]int64{ + 20326, + 20394, + 20398, + 20401, + 20405, + 20462, + 20470, + 20500, + 20524, + 20527, + 20532, + 20534, + 20537, + 20543, + 20553, + 20557, + 20589, + 20611, + 20693, + 20695, + 20712, + 20714, + 20733, + 20743, + 20744, + 20781, + 20789, + 20816, + 20905, + 20920, + 20921, + 20922, + 20923, + 20941, + 20947, + 20950, + 20951, + 20952, + 20967, + 20969, + 20973, + 21151, + 21672, + 21926, + 22273, + 22317, + 22328, + 22331, + 22334, + 22338, + }) globals.SugarLogger.Debugf("-items:= %s", utils.Format4Output(items, false)) globals.SugarLogger.Debugf("-items:= %v", err) }