当遇到 interface{},一档要处理,否则就会有 panic
for _, v := range countList {
var key uint64
switch val := v["parent_id"].(type) {
case uint64:
key = val
case int64:
key = uint64(val)
case float64:
key = uint64(val)
case string:
parsed, err := strconv.ParseUint(val, 10, 64)
if err != nil {
continue
}
key = parsed
default:
// 类型不支持,跳过
continue
}
}
















