This commit is contained in:
Mrx
2026-05-21 12:00:54 +08:00
parent 063fb158c9
commit d8b59829f1
3 changed files with 53 additions and 30 deletions

View File

@@ -5541,7 +5541,7 @@ func (s *ToolboxService) processGarbage(ctx context.Context, params map[string]i
}
reqParams["word"] = word
resp, err := s.tianxingjuheClient.Get("garbage/index", reqParams)
resp, err := s.tianxingjuheClient.Get("lajifenlei/index", reqParams)
if err != nil {
return nil, xerr.NewErrMsg(fmt.Sprintf("请求垃圾分类查询API失败: %v", err))
}
@@ -5586,6 +5586,12 @@ func (s *ToolboxService) processGarbage(ctx context.Context, params map[string]i
if explain, ok := raw["explain"]; ok {
clean["explain"] = explain
}
if tip, ok := raw["tip"]; ok {
clean["tip"] = tip
}
if contain, ok := raw["contain"]; ok {
clean["contain"] = contain
}
list = append(list, clean)
}
@@ -7402,11 +7408,25 @@ func (s *ToolboxService) processAnsLaJiFenLei(
return nil, xerr.NewErrMsg("解析垃圾分类问答数据失败")
}
return map[string]interface{}{
typeMap := map[int]string{
0: "可回收物",
1: "有害垃圾",
2: "厨余垃圾",
3: "其他垃圾",
}
clean := map[string]interface{}{
"name": result["name"],
"type": result["type"],
"explain": result["explain"],
}, nil
}
if t, ok := result["type"].(float64); ok {
if name, exists := typeMap[int(t)]; exists {
clean["type_name"] = name
}
}
return clean, nil
}
// processDouYinHot 抖音热搜榜查询