Bläddra i källkod

fix:更换东吴appid

zqbao 9 månader sedan
förälder
incheckning
b55e82a2cb
3 ändrade filer med 15 tillägg och 11 borttagningar
  1. 5 5
      services/wechat/wechat.go
  2. 9 5
      services/wx_app/wx_app.go
  3. 1 1
      utils/constants.go

+ 5 - 5
services/wechat/wechat.go

@@ -32,13 +32,13 @@ type WechatAccessToken struct {
 
 func GetWxChat() (officialAccount *officialaccount.OfficialAccount) {
 	wc := wechat.NewWechat()
-	minConf, _ := models.GetMiniConf()
+	// minConf, _ := models.GetMiniConf()
 	memory := cache.NewMemory()
 	conf := &config.Config{
-		// AppID:          utils.HZ_WX_APPID,
-		// AppSecret:      utils.HZ_WX_APP_SECRET,
-		AppID:          minConf["WxAppId"],
-		AppSecret:      minConf["WxAppSecret"],
+		AppID:     utils.DW_WX_APPID,
+		AppSecret: utils.DW_WX_APP_SECRET,
+		// AppID:          minConf["WxAppId"],
+		// AppSecret:      minConf["WxAppSecret"],
 		Token:          "",
 		EncodingAESKey: "",
 		Cache:          memory,

+ 9 - 5
services/wx_app/wx_app.go

@@ -1,6 +1,8 @@
 package wx_app
 
 import (
+	"eta/eta_mini_api/utils"
+
 	wechat "github.com/silenceper/wechat/v2"
 	"github.com/silenceper/wechat/v2/cache"
 	"github.com/silenceper/wechat/v2/miniprogram"
@@ -14,14 +16,16 @@ func GetWxApp() (miniprogram *miniprogram.MiniProgram) {
 	memory := cache.NewMemory()
 	//memory := cache.NewRedis(global.Redis)
 	// var WxId = `gh_75abb562a946`
-	var WxAppId = `wxb059c872d79b9967` // 投研小程序
-	var WxAppSecret = `1737c73e9f69a21de1a345b8f0800258`
+	// var WxAppId = `wxb059c872d79b9967` // 投研小程序
+	// var WxAppSecret = `1737c73e9f69a21de1a345b8f0800258`
 	cfg := &config.Config{
+		AppID:     utils.WX_APPID,
+		AppSecret: utils.WX_APP_SECRET,
 		// AppID:     utils.WX_APPID,
 		// AppSecret: utils.WX_APP_SECRET,
-		AppID:     WxAppId,
-		AppSecret: WxAppSecret,
-		Cache:     memory,
+		// AppID:     WxAppId,
+		// AppSecret: WxAppSecret,
+		Cache: memory,
 	}
 
 	miniprogram = wc.GetMiniProgram(cfg)

+ 1 - 1
utils/constants.go

@@ -67,5 +67,5 @@ const (
 
 // 缓存key
 const (
-	CACHE_WX_ACCESS_TOKEN_HZ = "wx:accesstoken:hzyj" //弘则研究公众号 微信accessToken
+	CACHE_WX_ACCESS_TOKEN_HZ = "wx:accesstoken:dwgzh" //弘则研究公众号 微信accessToken
 )