🎨 优化代码

This commit is contained in:
Binary Wang
2020-09-26 16:15:56 +08:00
parent 5ecfaf7cd0
commit 1d7344309a
67 changed files with 277 additions and 234 deletions

View File

@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.error.WxRuntimeException;
import me.chanjar.weixin.common.util.crypto.SHA1;
import me.chanjar.weixin.common.util.http.URIUtil;
import me.chanjar.weixin.common.util.json.GsonParser;
@@ -384,7 +385,7 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
config.updateAuthorizerRefreshToken(appId,wxOpenAuthorizerAccessToken.getAuthorizerRefreshToken());
return config.getAuthorizerAccessToken(appId);
} catch (InterruptedException e) {
throw new RuntimeException(e);
throw new WxRuntimeException(e);
} finally {
if (locked) {
lock.unlock();
@@ -488,7 +489,7 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
result = maService.post(requestUrl, param.toString());
return result;
default:
throw new WxErrorException(WxError.builder().errorCode(-1).errorMsg("appIdType类型异常").build());
throw new WxErrorException("appIdType类型异常");
}
}

View File

@@ -3,6 +3,7 @@ package me.chanjar.weixin.open.api.impl;
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.error.WxRuntimeException;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.common.util.http.RequestHttp;
import me.chanjar.weixin.open.api.WxOpenComponentService;
@@ -56,7 +57,7 @@ public abstract class WxOpenServiceAbstractImpl<H, P> implements WxOpenService,
return null;
} catch (IOException e) {
this.log.error("\n【请求地址】: {}\n【请求参数】{}\n【异常信息】{}", uri, data, e.getMessage());
throw new RuntimeException(e);
throw new WxRuntimeException(e);
}
}
}