refactor: modify method

This commit is contained in:
Daniel Qian
2015-01-20 15:14:14 +08:00
parent b613cf5479
commit 01cee5a3d9
4 changed files with 37 additions and 2 deletions

View File

@ -43,6 +43,14 @@ public interface WxCpService {
*/
public void userAuthenticated(String userId) throws WxErrorException;
/**
* 获取access_token, 不强制刷新access_token
* @see #getAccessToken(boolean)
* @return
* @throws WxErrorException
*/
public String getAccessToken() throws WxErrorException;
/**
* <pre>
* 获取access_token本方法线程安全

View File

@ -71,6 +71,10 @@ public class WxCpServiceImpl implements WxCpService {
execute(new SimpleGetRequestExecutor(), url, null);
}
public String getAccessToken() throws WxErrorException {
return getAccessToken(false);
}
public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {
wxCpConfigStorage.expireAccessToken();