This commit is contained in:
邹宗楠
2024-04-03 15:10:42 +08:00
parent 8b058f6469
commit 62827f0826

View File

@@ -146,9 +146,7 @@ func RefreshWeixin2Token() (err error) {
globals.SugarLogger.Errorf("RefreshWeixin2Token RefreshToken failed with error:%v", err)
}
} else {
tokenInfo := getWX2TokenFromRemote(api.WeixinMiniAPI2.CBGetToken())
globals.SugarLogger.Debugf("=================tokenInfo=1== := %s", utils.Format4Output(tokenInfo, false))
if tokenInfo != nil {
if tokenInfo := getWX2TokenFromRemote(api.WeixinMiniAPI2.CBGetToken()); tokenInfo != nil {
expireTimeStr = utils.Time2Str(time.Now().Add(-weixinTokenExpires))
token = tokenInfo.Token
}
@@ -362,7 +360,6 @@ func PollingRemotEvent(remoteURL string, waitSecond int, params map[string]inter
time.Sleep(errRefreshGap)
}
}
globals.SugarLogger.Debugf("tokenInfo========= :%s", utils.Format4Output(tokenInfo, false))
return tokenInfo
}
@@ -376,9 +373,7 @@ func getWXTokenFromRemote(oldToken string) (tokenInfo *syseventhub.TokenInfo) {
}
func getWX2TokenFromRemote(oldToken string) (tokenInfo *syseventhub.TokenInfo) {
globals.SugarLogger.Debugf("=========bool : %s", utils.Format4Output(!globals.IsMainProductEnv() && globals.GetWeixinTokenKey != "" && globals.GetWeixinTokenURL != "", false))
if !globals.IsMainProductEnv() && globals.GetWeixinTokenKey != "" && globals.GetWeixinTokenURL != "" {
globals.SugarLogger.Debugf("=========globals.GetWeixin2TokenURL : %s", utils.Format4Output(globals.GetWeixin2TokenURL, false))
tokenInfo = PollingRemotEvent(globals.GetWeixin2TokenURL, 0, map[string]interface{}{
"oldToken": oldToken,
})