mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	🎨 #1591 给部分请求方法导致无限递归调用的代码增加日志,方便排查问题
This commit is contained in:
		| @ -283,6 +283,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH | |||||||
|         // 强制设置wxCpConfigStorage它的access token过期了,这样在下一次请求里就会刷新access token |         // 强制设置wxCpConfigStorage它的access token过期了,这样在下一次请求里就会刷新access token | ||||||
|         this.configStorage.expireAccessToken(); |         this.configStorage.expireAccessToken(); | ||||||
|         if (this.getWxCpConfigStorage().autoRefreshToken()) { |         if (this.getWxCpConfigStorage().autoRefreshToken()) { | ||||||
|  |           log.warn("即将重新获取新的access_token,错误代码:{},错误信息:{}", error.getErrorCode(), error.getErrorMsg()); | ||||||
|           return this.execute(executor, uri, data); |           return this.execute(executor, uri, data); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ import lombok.SneakyThrows; | |||||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||||
| import me.chanjar.weixin.common.enums.WxType; | import me.chanjar.weixin.common.enums.WxType; | ||||||
| import me.chanjar.weixin.common.bean.WxAccessToken; | import me.chanjar.weixin.common.bean.WxAccessToken; | ||||||
|  | import me.chanjar.weixin.common.error.WxCpErrorMsgEnum; | ||||||
| import me.chanjar.weixin.common.error.WxError; | import me.chanjar.weixin.common.error.WxError; | ||||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||||
| import me.chanjar.weixin.common.util.DataUtils; | import me.chanjar.weixin.common.util.DataUtils; | ||||||
| @ -222,10 +223,11 @@ public abstract class BaseWxCpTpServiceImpl<H, P> implements WxCpTpService, Requ | |||||||
|        * 发生以下情况时尝试刷新suite_access_token |        * 发生以下情况时尝试刷新suite_access_token | ||||||
|        * 42009 suite_access_token已过期 |        * 42009 suite_access_token已过期 | ||||||
|        */ |        */ | ||||||
|       if (error.getErrorCode() == 42009) { |       if (error.getErrorCode() == WxCpErrorMsgEnum.CODE_42009.getCode()) { | ||||||
|         // 强制设置wxCpTpConfigStorage它的suite access token过期了,这样在下一次请求里就会刷新suite access token |         // 强制设置wxCpTpConfigStorage它的suite access token过期了,这样在下一次请求里就会刷新suite access token | ||||||
|         this.configStorage.expireSuiteAccessToken(); |         this.configStorage.expireSuiteAccessToken(); | ||||||
|         if (this.getWxCpTpConfigStorage().autoRefreshToken()) { |         if (this.getWxCpTpConfigStorage().autoRefreshToken()) { | ||||||
|  |           log.warn("即将重新获取新的access_token,错误代码:{},错误信息:{}", error.getErrorCode(), error.getErrorMsg()); | ||||||
|           return this.execute(executor, uri, data); |           return this.execute(executor, uri, data); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -255,6 +255,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH | |||||||
|           lock.unlock(); |           lock.unlock(); | ||||||
|         } |         } | ||||||
|         if (this.getWxMaConfig().autoRefreshToken()) { |         if (this.getWxMaConfig().autoRefreshToken()) { | ||||||
|  |           log.warn("即将重新获取新的access_token,错误代码:{},错误信息:{}", error.getErrorCode(), error.getErrorMsg()); | ||||||
|           return this.execute(executor, uri, data); |           return this.execute(executor, uri, data); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -372,6 +372,7 @@ public abstract class BaseWxMpServiceImpl<H, P> implements WxMpService, RequestH | |||||||
|           lock.unlock(); |           lock.unlock(); | ||||||
|         } |         } | ||||||
|         if (this.getWxMpConfigStorage().autoRefreshToken()) { |         if (this.getWxMpConfigStorage().autoRefreshToken()) { | ||||||
|  |           log.warn("即将重新获取新的access_token,错误代码:{},错误信息:{}", error.getErrorCode(), error.getErrorMsg()); | ||||||
|           return this.execute(executor, uri, data); |           return this.execute(executor, uri, data); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -161,6 +161,7 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService { | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (this.getWxOpenConfigStorage().autoRefreshToken()) { |         if (this.getWxOpenConfigStorage().autoRefreshToken()) { | ||||||
|  |           log.warn("即将重新获取新的access_token,错误代码:{},错误信息:{}", error.getErrorCode(), error.getErrorMsg()); | ||||||
|           return this.post(uri, postData, accessTokenKey); |           return this.post(uri, postData, accessTokenKey); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
| @ -198,6 +199,7 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService { | |||||||
|           lock.unlock(); |           lock.unlock(); | ||||||
|         } |         } | ||||||
|         if (this.getWxOpenConfigStorage().autoRefreshToken()) { |         if (this.getWxOpenConfigStorage().autoRefreshToken()) { | ||||||
|  |           log.warn("即将重新获取新的access_token,错误代码:{},错误信息:{}", error.getErrorCode(), error.getErrorMsg()); | ||||||
|           return this.get(uri, accessTokenKey); |           return this.get(uri, accessTokenKey); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang