File tree Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Original file line number Diff line number Diff line change 2
2
package kfccrazythursday
3
3
4
4
import (
5
- "encoding/json"
6
-
7
5
"github.com/FloatTech/floatbox/web"
8
6
ctrl "github.com/FloatTech/zbpctrl"
9
7
"github.com/FloatTech/zbputils/control"
@@ -15,12 +13,6 @@ const (
15
13
crazyURL = "https://api.pearktrue.cn/api/kfc/"
16
14
)
17
15
18
- type crazyResponse struct {
19
- Code int `json:"code"`
20
- Msg string `json:"msg"`
21
- Text string `json:"text"`
22
- }
23
-
24
16
func init () {
25
17
engine := control .AutoRegister (& ctrl.Options [* zero.Ctx ]{
26
18
DisableOnDefault : false ,
@@ -34,17 +26,7 @@ func init() {
34
26
return
35
27
}
36
28
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 )))
49
31
})
50
32
}
You can’t perform that action at this time.
0 commit comments