From 0adc2ff6287411dc52d5660593c9dced597d1207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Mon, 24 Jun 2024 08:40:24 +0800 Subject: [PATCH] =?UTF-8?q?:fire:=20=E4=BF=AE=E6=94=B9=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E6=97=A9=E6=8A=A5=E6=8E=A5=E5=8F=A3=20Token=20=E4=B8=BA?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yaml | 3 +++ config/system.go | 1 + utils/news.go | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 7c73209..15793ed 100644 --- a/config.yaml +++ b/config.yaml @@ -1,4 +1,7 @@ system: + # 每日新闻接口 Token + # 获取地址: https://admin.alapi.cn/api_manager/token_manager + alApiToken: xxx # 添加新好友或群之后通知给指定的人 newFriendNotify: enable: true diff --git a/config/system.go b/config/system.go index 9c3ca76..990735c 100644 --- a/config/system.go +++ b/config/system.go @@ -2,6 +2,7 @@ package config // 系统配置 type system struct { + AlApiToken string `json:"alApiToken" yaml:"alApiToken"` // AL API Token NewFriendNotify newFriendNotify `json:"newFriendNotify" yaml:"newFriendNotify"` // 新好友通知 DefaultRule defaultRule `json:"defaultRule" yaml:"defaultRule"` // 默认规则 } diff --git a/utils/news.go b/utils/news.go index 6d6c60b..dcfc032 100644 --- a/utils/news.go +++ b/utils/news.go @@ -2,6 +2,7 @@ package utils import ( "github.com/go-resty/resty/v2" + "go-wechat/config" "go-wechat/model" "log" ) @@ -33,7 +34,7 @@ func (news) MorningPost() (records []string) { res := resty.New() resp, err := res.R(). SetHeader("Content-Type", "application/json;chartset=utf-8"). - SetQueryParam("token", "cFoMZNNBxT4jQovS"). + SetQueryParam("token", config.Conf.System.AlApiToken). SetResult(&newsResp). Post("https://v2.alapi.cn/api/zaobao") if err != nil {