This commit is contained in:
邹宗楠
2026-03-25 14:55:41 +08:00
parent 47d67bb9d8
commit 66064f8de2
3 changed files with 62 additions and 2 deletions

View File

@@ -294,6 +294,11 @@ func TestRetailInitData(t *testing.T) {
for { for {
// 同步商品 // 同步商品
fromFoodList, err1 := api.RetailListAll("21494359", i) fromFoodList, err1 := api.RetailListAll("21494359", i)
for _, v := range fromFoodList {
if v.AppFoodCode == "mtcode_1902626039134900287" {
fmt.Println(v)
}
}
if len(fromFoodList) == 0 || fromFoodList == nil { if len(fromFoodList) == 0 || fromFoodList == nil {
fmt.Println(fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i)) fmt.Println(fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i))
return return

View File

@@ -142,7 +142,11 @@ func (a *API) BatchGetChannelCategoryMapping(categoryIds []int64) (map[int64]int
mappingData := make(map[int64]int64, 0) mappingData := make(map[int64]int64, 0)
for _, v := range result.Data.RespItems { 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 return mappingData, nil

View File

@@ -32,7 +32,58 @@ func TestGetRecommendCategoryByName(t *testing.T) {
} }
func TestBatchGetChannelCategoryMapping(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:= %s", utils.Format4Output(items, false))
globals.SugarLogger.Debugf("-items:= %v", err) globals.SugarLogger.Debugf("-items:= %v", err)
} }