feat: 发送养护订阅消息

This commit is contained in:
Blizzard
2026-02-11 08:58:26 +08:00
parent dd6a638982
commit 88aeb86296
7 changed files with 148 additions and 161 deletions
+2
View File
@@ -31,6 +31,8 @@ func TimeInterval(targetTime time.Time) string {
case totalMinutes >= 60: // 1小时 = 60分钟
hours := totalMinutes / 60
return fmt.Sprintf("%d小时前", hours)
case totalMinutes < 1:
return "刚刚"
default: // 不足1小时
return fmt.Sprintf("%d分钟前", totalMinutes)
}
+3 -4
View File
@@ -6,8 +6,8 @@ import (
"errors"
"io"
"log"
"net/http"
"sundynix-go/global"
"sundynix-go/pkg/httpclient"
"time"
"github.com/redis/go-redis/v9"
@@ -20,7 +20,8 @@ func GetMiniAccessToken() string {
// 从微信服务器获取
//重新从微信服务器获取
url := "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + global.Config.MiniProgram.AppId + "&secret=" + global.Config.MiniProgram.AppSecret
resp, err := http.Get(url)
myHttpClient := httpclient.GetClient()
resp, err := myHttpClient.Get(url)
if err != nil {
log.Fatalf("Error making GET request: %s", err)
}
@@ -46,8 +47,6 @@ func GetMiniAccessToken() string {
global.Redis.Set(context.Background(), "mini_access_token", ak, time.Duration(ex)*time.Second) //秒
} else if err != nil {
log.Fatalf("Error getting access token from Redis: %s", err)
} else {
return ak
}
return ak