From b6ddda1d51e85e8a115937fbc5282ff72c700efd Mon Sep 17 00:00:00 2001 From: Dodoj <31199261+Doordoorjay@users.noreply.github.com> Date: Fri, 25 Jul 2025 09:31:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(kfccrazythursday):=20API=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=20(#1184)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/kfccrazythursday/kfccrazythursday.go | 22 ++------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/plugin/kfccrazythursday/kfccrazythursday.go b/plugin/kfccrazythursday/kfccrazythursday.go index 37334039..d144cdae 100644 --- a/plugin/kfccrazythursday/kfccrazythursday.go +++ b/plugin/kfccrazythursday/kfccrazythursday.go @@ -2,8 +2,6 @@ package kfccrazythursday import ( - "encoding/json" - "github.com/FloatTech/floatbox/web" ctrl "github.com/FloatTech/zbpctrl" "github.com/FloatTech/zbputils/control" @@ -15,12 +13,6 @@ const ( crazyURL = "https://api.pearktrue.cn/api/kfc/" ) -type crazyResponse struct { - Code int `json:"code"` - Msg string `json:"msg"` - Text string `json:"text"` -} - func init() { engine := control.AutoRegister(&ctrl.Options[*zero.Ctx]{ DisableOnDefault: false, @@ -34,17 +26,7 @@ func init() { return } - var resp crazyResponse - if err := json.Unmarshal(data, &resp); err != nil { - ctx.SendChain(message.Text("JSON解析失败: ", err)) - return - } - - if resp.Code != 200 { - ctx.SendChain(message.Text("API返回错误: ", resp.Msg)) - return - } - - ctx.SendChain(message.Text(resp.Text)) + // 根据来源API修改返回方式到直接输出文本 + ctx.SendChain(message.Text(string(data))) }) }