Skip to content

Commit 8a00149

Browse files
committed
🐛 更新疫情API
1 parent 228ca7f commit 8a00149

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

plugin/epidemic/epidemic.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ import (
77
zero "github.com/wdvxdr1123/ZeroBot"
88
"github.com/wdvxdr1123/ZeroBot/message"
99

10-
"github.com/FloatTech/zbputils/binary"
1110
"github.com/FloatTech/zbputils/control"
1211
"github.com/FloatTech/zbputils/ctxext"
1312
"github.com/FloatTech/zbputils/web"
1413
)
1514

1615
const (
1716
servicename = "epidemic"
18-
txurl = "https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5"
17+
txurl = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf"
1918
)
2019

2120
// result 疫情查询结果
2221
type result struct {
23-
Data string `json:"data"`
22+
Data struct {
23+
Epidemic epidemic `json:"diseaseh5Shelf"`
24+
} `json:"data"`
2425
}
2526

2627
// epidemic 疫情数据
@@ -116,11 +117,6 @@ func queryEpidemic(findCityName string) (citydata *area, times string, err error
116117
if err != nil {
117118
return
118119
}
119-
var e epidemic
120-
err = json.Unmarshal(binary.StringToBytes(r.Data), &e)
121-
if err != nil {
122-
return
123-
}
124-
citydata = rcity(e.AreaTree[0], findCityName)
125-
return citydata, e.LastUpdateTime, nil
120+
citydata = rcity(r.Data.Epidemic.AreaTree[0], findCityName)
121+
return citydata, r.Data.Epidemic.LastUpdateTime, nil
126122
}

0 commit comments

Comments
 (0)