mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	🎨 优化重构部分代码,抽取公共常量
This commit is contained in:
		| @ -4,8 +4,9 @@ import com.google.common.base.Joiner; | ||||
| import com.google.gson.JsonArray; | ||||
| import com.google.gson.JsonObject; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import me.chanjar.weixin.common.enums.WxType; | ||||
| import me.chanjar.weixin.common.api.WxConsts; | ||||
| import me.chanjar.weixin.common.bean.WxJsapiSignature; | ||||
| import me.chanjar.weixin.common.enums.WxType; | ||||
| import me.chanjar.weixin.common.error.WxError; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import me.chanjar.weixin.common.session.StandardSessionManager; | ||||
| @ -277,13 +278,8 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH | ||||
|       return result; | ||||
|     } catch (WxErrorException e) { | ||||
|       WxError error = e.getError(); | ||||
|       /* | ||||
|        * 发生以下情况时尝试刷新access_token | ||||
|        * 40001 获取access_token时AppSecret错误,或者access_token无效 | ||||
|        * 42001 access_token超时 | ||||
|        * 40014 不合法的access_token,请开发者认真比对access_token的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口 | ||||
|        */ | ||||
|       if (error.getErrorCode() == 42001 || error.getErrorCode() == 40001 || error.getErrorCode() == 40014) { | ||||
|  | ||||
|       if (WxConsts.ACCESS_TOKEN_ERROR_CODES.contains(error.getErrorCode())) { | ||||
|         // 强制设置wxCpConfigStorage它的access token过期了,这样在下一次请求里就会刷新access token | ||||
|         this.configStorage.expireAccessToken(); | ||||
|         if (this.getWxCpConfigStorage().autoRefreshToken()) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang