JSSDKHelper rename to JSSDKConfigurator & 重构了token类

This commit is contained in:
jinyu
2015-12-25 15:29:31 +08:00
parent ab0619ac38
commit 8da3fab8b8
20 changed files with 105 additions and 43 deletions
@@ -184,7 +184,7 @@ public class SuiteApi extends QyApi {
suitePerCodeHolder, suiteTokenHolder);
Token token = new Token(obj.getString("access_token"));
token.setExpiresIn(obj.getIntValue("expires_in"));
token.setTime(System.currentTimeMillis());
token.setCreateTime(System.currentTimeMillis());
suiteTicketHolder.getTokenStorager().caching(
tokenCreator.getCacheKey(), token);
// 缓存微信企业号永久授权码
@@ -54,7 +54,8 @@ public class WeixinSuitePreCodeCreator implements TokenCreator {
JSONObject result = response.getAsJson();
Token token = new Token(result.getString("pre_auth_code"));
token.setExpiresIn(result.getIntValue("expires_in"));
token.setTime(System.currentTimeMillis());
token.setCreateTime(System.currentTimeMillis());
token.setOriginalResult(response.getAsString());
return token;
}
}
@@ -50,7 +50,8 @@ public class WeixinSuiteTokenCreator implements TokenCreator {
obj = response.getAsJson();
Token token = new Token(obj.getString("suite_access_token"));
token.setExpiresIn(obj.getIntValue("expires_in"));
token.setTime(System.currentTimeMillis());
token.setCreateTime(System.currentTimeMillis());
token.setOriginalResult(response.getAsString());
return token;
}
}
@@ -60,7 +60,8 @@ public class WeixinTokenSuiteCreator implements TokenCreator {
obj = response.getAsJson();
Token token = new Token(obj.getString("access_token"));
token.setExpiresIn(obj.getIntValue("expires_in"));
token.setTime(System.currentTimeMillis());
token.setCreateTime(System.currentTimeMillis());
token.setOriginalResult(response.getAsString());
return token;
}
@@ -52,7 +52,8 @@ public class WeixinJSTicketCreator implements TokenCreator {
JSONObject result = response.getAsJson();
Token token = new Token(result.getString("ticket"));
token.setExpiresIn(result.getIntValue("expires_in"));
token.setTime(System.currentTimeMillis());
token.setCreateTime(System.currentTimeMillis());
token.setOriginalResult(response.getAsString());
return token;
}
}
@@ -53,7 +53,8 @@ public class WeixinProviderTokenCreator implements TokenCreator {
obj = response.getAsJson();
Token token = new Token(obj.getString("provider_access_token"));
token.setExpiresIn(obj.getIntValue("expires_in"));
token.setTime(System.currentTimeMillis());
token.setCreateTime(System.currentTimeMillis());
token.setOriginalResult(response.getAsString());
return token;
}
}
@@ -50,7 +50,8 @@ public class WeixinTokenCreator implements TokenCreator {
WeixinResponse response = weixinExecutor.get(tokenUrl);
Token token = response.getAsObject(new TypeReference<Token>() {
});
token.setTime(System.currentTimeMillis());
token.setCreateTime(System.currentTimeMillis());
token.setOriginalResult(response.getAsString());
return token;
}
}
@@ -29,6 +29,11 @@ public final class URLConsts {
*/
public static final String JS_TICKET_URL = BASE_URL
+ "/get_jsapi_ticket?access_token=%s";
/**
* 企业号获取ticket的url
*/
public static final String TICKET_URL = BASE_URL
+ "/ticket/get?access_token=%s&type=%s";
/**
* 企业号第三方应用套件获取token的url
*/