update something
This commit is contained in:
parent
dbdc5eee72
commit
0b35861009
@ -39,6 +39,11 @@ public class WeixinSuiteProxy {
|
||||
this(suiteId, suiteSecret, QyApi.DEFAULT_TOKEN_STORAGER);
|
||||
}
|
||||
|
||||
public WeixinSuiteProxy(TokenStorager tokenStorager) throws WeixinException {
|
||||
this(QyApi.DEFAULT_WEIXIN_ACCOUNT.getSuiteId(),
|
||||
QyApi.DEFAULT_WEIXIN_ACCOUNT.getSuiteSecret(), tokenStorager);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param suiteId
|
||||
@ -53,13 +58,13 @@ public class WeixinSuiteProxy {
|
||||
*/
|
||||
public WeixinSuiteProxy(String suiteId, String suiteSecret,
|
||||
TokenStorager tokenStorager) throws WeixinException {
|
||||
this.suiteApi = new SuiteApi(suiteId, suiteSecret, tokenStorager);
|
||||
this(new SuiteTicketHolder(suiteId, suiteSecret, tokenStorager));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param suiteTicketHolder
|
||||
* 套件ticket存取
|
||||
* 套件ticket的存取
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public WeixinSuiteProxy(SuiteTicketHolder suiteTicketHolder)
|
||||
|
||||
@ -18,7 +18,6 @@ import com.foxinmy.weixin4j.qy.suite.WeixinSuiteTokenCreator;
|
||||
import com.foxinmy.weixin4j.qy.suite.WeixinTokenSuiteCreator;
|
||||
import com.foxinmy.weixin4j.token.TokenCreator;
|
||||
import com.foxinmy.weixin4j.token.TokenHolder;
|
||||
import com.foxinmy.weixin4j.token.TokenStorager;
|
||||
|
||||
/**
|
||||
* 第三方应用套件
|
||||
@ -48,34 +47,12 @@ public class SuiteApi extends QyApi {
|
||||
*/
|
||||
private final TokenHolder suitePreCodeHolder;
|
||||
|
||||
public SuiteApi() throws WeixinException {
|
||||
this(DEFAULT_WEIXIN_ACCOUNT.getSuiteId(), DEFAULT_WEIXIN_ACCOUNT
|
||||
.getSuiteSecret());
|
||||
}
|
||||
|
||||
public SuiteApi(String suiteId, String suiteSecret) throws WeixinException {
|
||||
this(suiteId, suiteSecret, DEFAULT_TOKEN_STORAGER);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param suiteId
|
||||
* 应用ID
|
||||
* @param suiteSecret
|
||||
* 应用secret
|
||||
* @param tokenStorager
|
||||
* 应用token存储器
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public SuiteApi(String suiteId, String suiteSecret,
|
||||
TokenStorager tokenStorager) throws WeixinException {
|
||||
this(new SuiteTicketHolder(suiteId, suiteSecret, tokenStorager));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param suiteTicketHolder
|
||||
* 套件ticket存取
|
||||
* @param tokenStorager
|
||||
* 应用token存储器
|
||||
* @throws WeixinException
|
||||
*/
|
||||
public SuiteApi(SuiteTicketHolder suiteTicketHolder) throws WeixinException {
|
||||
@ -153,7 +130,7 @@ public class SuiteApi extends QyApi {
|
||||
public JsonResult setSuiteSession(int... appids) throws WeixinException {
|
||||
String suite_set_session_uri = getRequestUri("suite_set_session_uri");
|
||||
JSONObject para = new JSONObject();
|
||||
para.put("pre_auth_code", suiteTicketHolder.getTicket());
|
||||
para.put("pre_auth_code", suitePreCodeHolder.getAccessToken());
|
||||
para.put("session_info", appids);
|
||||
WeixinResponse response = weixinClient
|
||||
.post(String.format(suite_set_session_uri,
|
||||
|
||||
@ -41,7 +41,7 @@ public class SuitePerCodeHolder {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getCacheKey() {
|
||||
public String getCacheKey() {
|
||||
return String.format("qy_suite_percode_%s", suiteId);
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,6 @@ public class SuiteTicketHolder {
|
||||
/**
|
||||
* 查找ticket
|
||||
*
|
||||
* @param suiteId
|
||||
* @return
|
||||
* @throws WeixinException
|
||||
*/
|
||||
@ -40,10 +39,9 @@ public class SuiteTicketHolder {
|
||||
/**
|
||||
* 获取ticket的key
|
||||
*
|
||||
* @param suiteId
|
||||
* @return
|
||||
*/
|
||||
private String getCacheKey() {
|
||||
public String getCacheKey() {
|
||||
return String.format("qy_suite_ticket_%s", suiteId);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user