Skip to content

Commit b6ddda1

Browse files
authored
fix(kfccrazythursday): API解析 (FloatTech#1184)
1 parent a1621f3 commit b6ddda1

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

plugin/kfccrazythursday/kfccrazythursday.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
package kfccrazythursday
33

44
import (
5-
"encoding/json"
6-
75
"github.com/FloatTech/floatbox/web"
86
ctrl "github.com/FloatTech/zbpctrl"
97
"github.com/FloatTech/zbputils/control"
@@ -15,12 +13,6 @@ const (
1513
crazyURL = "https://api.pearktrue.cn/api/kfc/"
1614
)
1715

18-
type crazyResponse struct {
19-
Code int `json:"code"`
20-
Msg string `json:"msg"`
21-
Text string `json:"text"`
22-
}
23-
2416
func init() {
2517
engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{
2618
DisableOnDefault: false,
@@ -34,17 +26,7 @@ func init() {
3426
return
3527
}
3628

37-
var resp crazyResponse
38-
if err := json.Unmarshal(data, &resp); err != nil {
39-
ctx.SendChain(message.Text("JSON解析失败: ", err))
40-
return
41-
}
42-
43-
if resp.Code != 200 {
44-
ctx.SendChain(message.Text("API返回错误: ", resp.Msg))
45-
return
46-
}
47-
48-
ctx.SendChain(message.Text(resp.Text))
29+
// 根据来源API修改返回方式到直接输出文本
30+
ctx.SendChain(message.Text(string(data)))
4931
})
5032
}

0 commit comments

Comments
 (0)