新增微信公众平台对接,增加缓存。默认10天

This commit is contained in:
2024-03-05 16:07:42 +08:00
parent b4039aab81
commit 02561cf149
3 changed files with 18 additions and 6 deletions
+7
View File
@@ -1,11 +1,14 @@
package Scheme
import (
"context"
"encoding/json"
"errors"
"fmt"
"hospital-open-api/extend/weChat"
"hospital-open-api/global"
"strings"
"time"
)
// GetSchemeJumpWxaRequest 跳转到的目标小程序信息
@@ -74,5 +77,9 @@ func (r *GetSchemeRequest) GetScheme(userType int) (string, error) {
return "", errors.New("失败")
}
// 加入缓存
redisKey := "c:official_account.scheme." + r.JumpWxa.Path + "." + r.JumpWxa.Query
global.Redis.Set(context.Background(), redisKey, GetSchemeResponse.OpenLink, 60*60*24*10*time.Second)
return GetSchemeResponse.OpenLink, nil
}