| @@ -44,27 +44,33 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| protected volatile ApacheHttpClientBuilder apacheHttpClientBuilder; | protected volatile ApacheHttpClientBuilder apacheHttpClientBuilder; | ||||
| @Override | |||||
| public String getAccessToken() { | public String getAccessToken() { | ||||
| return this.accessToken; | return this.accessToken; | ||||
| } | } | ||||
| @Override | |||||
| public boolean isAccessTokenExpired() { | public boolean isAccessTokenExpired() { | ||||
| return System.currentTimeMillis() > this.expiresTime; | return System.currentTimeMillis() > this.expiresTime; | ||||
| } | } | ||||
| @Override | |||||
| public synchronized void updateAccessToken(WxAccessToken accessToken) { | public synchronized void updateAccessToken(WxAccessToken accessToken) { | ||||
| updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn()); | updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn()); | ||||
| } | } | ||||
| @Override | |||||
| public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) { | public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) { | ||||
| this.accessToken = accessToken; | this.accessToken = accessToken; | ||||
| this.expiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l; | this.expiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l; | ||||
| } | } | ||||
| @Override | |||||
| public void expireAccessToken() { | public void expireAccessToken() { | ||||
| this.expiresTime = 0; | this.expiresTime = 0; | ||||
| } | } | ||||
| @Override | |||||
| public String getJsapiTicket() { | public String getJsapiTicket() { | ||||
| return jsapiTicket; | return jsapiTicket; | ||||
| } | } | ||||
| @@ -81,16 +87,19 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| this.jsapiTicketExpiresTime = jsapiTicketExpiresTime; | this.jsapiTicketExpiresTime = jsapiTicketExpiresTime; | ||||
| } | } | ||||
| @Override | |||||
| public boolean isJsapiTicketExpired() { | public boolean isJsapiTicketExpired() { | ||||
| return System.currentTimeMillis() > this.jsapiTicketExpiresTime; | return System.currentTimeMillis() > this.jsapiTicketExpiresTime; | ||||
| } | } | ||||
| @Override | |||||
| public synchronized void updateJsapiTicket(String jsapiTicket, int expiresInSeconds) { | public synchronized void updateJsapiTicket(String jsapiTicket, int expiresInSeconds) { | ||||
| this.jsapiTicket = jsapiTicket; | this.jsapiTicket = jsapiTicket; | ||||
| // 预留200秒的时间 | // 预留200秒的时间 | ||||
| this.jsapiTicketExpiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l; | this.jsapiTicketExpiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l; | ||||
| } | } | ||||
| @Override | |||||
| public void expireJsapiTicket() { | public void expireJsapiTicket() { | ||||
| this.jsapiTicketExpiresTime = 0; | this.jsapiTicketExpiresTime = 0; | ||||
| } | } | ||||
| @@ -98,36 +107,44 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| /** | /** | ||||
| * 卡券api_ticket | * 卡券api_ticket | ||||
| */ | */ | ||||
| @Override | |||||
| public String getCardApiTicket() { | public String getCardApiTicket() { | ||||
| return cardApiTicket; | return cardApiTicket; | ||||
| } | } | ||||
| @Override | |||||
| public boolean isCardApiTicketExpired() { | public boolean isCardApiTicketExpired() { | ||||
| return System.currentTimeMillis() > this.cardApiTicketExpiresTime; | return System.currentTimeMillis() > this.cardApiTicketExpiresTime; | ||||
| } | } | ||||
| @Override | |||||
| public synchronized void updateCardApiTicket(String cardApiTicket, int expiresInSeconds) { | public synchronized void updateCardApiTicket(String cardApiTicket, int expiresInSeconds) { | ||||
| this.cardApiTicket = cardApiTicket; | this.cardApiTicket = cardApiTicket; | ||||
| // 预留200秒的时间 | // 预留200秒的时间 | ||||
| this.cardApiTicketExpiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l; | this.cardApiTicketExpiresTime = System.currentTimeMillis() + (expiresInSeconds - 200) * 1000l; | ||||
| } | } | ||||
| @Override | |||||
| public void expireCardApiTicket() { | public void expireCardApiTicket() { | ||||
| this.cardApiTicketExpiresTime = 0; | this.cardApiTicketExpiresTime = 0; | ||||
| } | } | ||||
| @Override | |||||
| public String getAppId() { | public String getAppId() { | ||||
| return this.appId; | return this.appId; | ||||
| } | } | ||||
| @Override | |||||
| public String getSecret() { | public String getSecret() { | ||||
| return this.secret; | return this.secret; | ||||
| } | } | ||||
| @Override | |||||
| public String getToken() { | public String getToken() { | ||||
| return this.token; | return this.token; | ||||
| } | } | ||||
| @Override | |||||
| public long getExpiresTime() { | public long getExpiresTime() { | ||||
| return this.expiresTime; | return this.expiresTime; | ||||
| } | } | ||||
| @@ -144,6 +161,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| this.token = token; | this.token = token; | ||||
| } | } | ||||
| @Override | |||||
| public String getAesKey() { | public String getAesKey() { | ||||
| return aesKey; | return aesKey; | ||||
| } | } | ||||
| @@ -169,6 +187,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| this.oauth2redirectUri = oauth2redirectUri; | this.oauth2redirectUri = oauth2redirectUri; | ||||
| } | } | ||||
| @Override | |||||
| public String getHttp_proxy_host() { | public String getHttp_proxy_host() { | ||||
| return http_proxy_host; | return http_proxy_host; | ||||
| } | } | ||||
| @@ -177,6 +196,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| this.http_proxy_host = http_proxy_host; | this.http_proxy_host = http_proxy_host; | ||||
| } | } | ||||
| @Override | |||||
| public int getHttp_proxy_port() { | public int getHttp_proxy_port() { | ||||
| return http_proxy_port; | return http_proxy_port; | ||||
| } | } | ||||
| @@ -185,6 +205,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| this.http_proxy_port = http_proxy_port; | this.http_proxy_port = http_proxy_port; | ||||
| } | } | ||||
| @Override | |||||
| public String getHttp_proxy_username() { | public String getHttp_proxy_username() { | ||||
| return http_proxy_username; | return http_proxy_username; | ||||
| } | } | ||||
| @@ -193,6 +214,7 @@ public class WxMpInMemoryConfigStorage implements WxMpConfigStorage { | |||||
| this.http_proxy_username = http_proxy_username; | this.http_proxy_username = http_proxy_username; | ||||
| } | } | ||||
| @Override | |||||
| public String getHttp_proxy_password() { | public String getHttp_proxy_password() { | ||||
| return http_proxy_password; | return http_proxy_password; | ||||
| } | } | ||||