mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-07-18 22:35:48 +08:00
Merge pull request #76 from wechat-group/revert-75-agentid-type
Revert "修改WxCpMessage中agentId的数据类型, String-> Integer"
This commit is contained in:
commit
e7d70307eb
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,7 +26,6 @@ test-config.xml
|
|||||||
/gradle/
|
/gradle/
|
||||||
*.bat
|
*.bat
|
||||||
/gradlew
|
/gradlew
|
||||||
**/build/
|
|
||||||
|
|
||||||
# OSX
|
# OSX
|
||||||
# Icon must end with two \r
|
# Icon must end with two \r
|
||||||
|
@ -45,7 +45,7 @@ public interface WxCpConfigStorage {
|
|||||||
|
|
||||||
String getCorpSecret();
|
String getCorpSecret();
|
||||||
|
|
||||||
Integer getAgentId();
|
String getAgentId();
|
||||||
|
|
||||||
String getToken();
|
String getToken();
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class WxCpInMemoryConfigStorage implements WxCpConfigStorage {
|
|||||||
protected volatile String token;
|
protected volatile String token;
|
||||||
protected volatile String accessToken;
|
protected volatile String accessToken;
|
||||||
protected volatile String aesKey;
|
protected volatile String aesKey;
|
||||||
protected volatile Integer agentId;
|
protected volatile String agentId;
|
||||||
protected volatile long expiresTime;
|
protected volatile long expiresTime;
|
||||||
|
|
||||||
protected volatile String oauth2redirectUri;
|
protected volatile String oauth2redirectUri;
|
||||||
@ -146,11 +146,11 @@ public class WxCpInMemoryConfigStorage implements WxCpConfigStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getAgentId() {
|
public String getAgentId() {
|
||||||
return this.agentId;
|
return this.agentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAgentId(Integer agentId) {
|
public void setAgentId(String agentId) {
|
||||||
this.agentId = agentId;
|
this.agentId = agentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,267 +1,267 @@
|
|||||||
package me.chanjar.weixin.cp.api;
|
package me.chanjar.weixin.cp.api;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import me.chanjar.weixin.common.bean.WxAccessToken;
|
import me.chanjar.weixin.common.bean.WxAccessToken;
|
||||||
import me.chanjar.weixin.common.util.http.ApacheHttpClientBuilder;
|
import me.chanjar.weixin.common.util.http.ApacheHttpClientBuilder;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jedis client implementor for wechat config storage
|
* Jedis client implementor for wechat config storage
|
||||||
*
|
*
|
||||||
* @author gaigeshen
|
* @author gaigeshen
|
||||||
*/
|
*/
|
||||||
public class WxCpJedisConfigStorage implements WxCpConfigStorage {
|
public class WxCpJedisConfigStorage implements WxCpConfigStorage {
|
||||||
|
|
||||||
/* Redis keys here */
|
/* Redis keys here */
|
||||||
private static final String ACCESS_TOKEN_KEY = "WX_CP_ACCESS_TOKEN";
|
private static final String ACCESS_TOKEN_KEY = "WX_CP_ACCESS_TOKEN";
|
||||||
private static final String ACCESS_TOKEN_EXPIRES_TIME_KEY = "WX_CP_ACCESS_TOKEN_EXPIRES_TIME";
|
private static final String ACCESS_TOKEN_EXPIRES_TIME_KEY = "WX_CP_ACCESS_TOKEN_EXPIRES_TIME";
|
||||||
private static final String JS_API_TICKET_KEY = "WX_CP_JS_API_TICKET";
|
private static final String JS_API_TICKET_KEY = "WX_CP_JS_API_TICKET";
|
||||||
private static final String JS_API_TICKET_EXPIRES_TIME_KEY = "WX_CP_JS_API_TICKET_EXPIRES_TIME";
|
private static final String JS_API_TICKET_EXPIRES_TIME_KEY = "WX_CP_JS_API_TICKET_EXPIRES_TIME";
|
||||||
|
|
||||||
private volatile String corpId;
|
private volatile String corpId;
|
||||||
private volatile String corpSecret;
|
private volatile String corpSecret;
|
||||||
|
|
||||||
private volatile String token;
|
private volatile String token;
|
||||||
private volatile String aesKey;
|
private volatile String aesKey;
|
||||||
private volatile Integer agentId;
|
private volatile String agentId;
|
||||||
|
|
||||||
private volatile String oauth2redirectUri;
|
private volatile String oauth2redirectUri;
|
||||||
|
|
||||||
private volatile String httpProxyHost;
|
private volatile String httpProxyHost;
|
||||||
private volatile int httpProxyPort;
|
private volatile int httpProxyPort;
|
||||||
private volatile String httpProxyUsername;
|
private volatile String httpProxyUsername;
|
||||||
private volatile String httpProxyPassword;
|
private volatile String httpProxyPassword;
|
||||||
|
|
||||||
private volatile File tmpDirFile;
|
private volatile File tmpDirFile;
|
||||||
|
|
||||||
private volatile ApacheHttpClientBuilder apacheHttpClientBuilder;
|
private volatile ApacheHttpClientBuilder apacheHttpClientBuilder;
|
||||||
|
|
||||||
/* Redis clients pool */
|
/* Redis clients pool */
|
||||||
private final JedisPool jedisPool;
|
private final JedisPool jedisPool;
|
||||||
|
|
||||||
public WxCpJedisConfigStorage(String host, int port) {
|
public WxCpJedisConfigStorage(String host, int port) {
|
||||||
this.jedisPool = new JedisPool(host, port);
|
this.jedisPool = new JedisPool(host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* This method will be destroy jedis pool
|
* This method will be destroy jedis pool
|
||||||
*/
|
*/
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
this.jedisPool.destroy();
|
this.jedisPool.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAccessToken() {
|
public String getAccessToken() {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
return jedis.get(ACCESS_TOKEN_KEY);
|
return jedis.get(ACCESS_TOKEN_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAccessTokenExpired() {
|
public boolean isAccessTokenExpired() {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
String expiresTimeStr = jedis.get(ACCESS_TOKEN_EXPIRES_TIME_KEY);
|
String expiresTimeStr = jedis.get(ACCESS_TOKEN_EXPIRES_TIME_KEY);
|
||||||
|
|
||||||
if (expiresTimeStr != null) {
|
if (expiresTimeStr != null) {
|
||||||
Long expiresTime = Long.parseLong(expiresTimeStr);
|
Long expiresTime = Long.parseLong(expiresTimeStr);
|
||||||
return System.currentTimeMillis() > expiresTime;
|
return System.currentTimeMillis() > expiresTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void expireAccessToken() {
|
public void expireAccessToken() {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
jedis.set(ACCESS_TOKEN_EXPIRES_TIME_KEY, "0");
|
jedis.set(ACCESS_TOKEN_EXPIRES_TIME_KEY, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void updateAccessToken(WxAccessToken accessToken) {
|
public synchronized void updateAccessToken(WxAccessToken accessToken) {
|
||||||
this.updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
|
this.updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) {
|
public synchronized void updateAccessToken(String accessToken, int expiresInSeconds) {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
jedis.set(ACCESS_TOKEN_KEY, accessToken);
|
jedis.set(ACCESS_TOKEN_KEY, accessToken);
|
||||||
|
|
||||||
jedis.set(ACCESS_TOKEN_EXPIRES_TIME_KEY,
|
jedis.set(ACCESS_TOKEN_EXPIRES_TIME_KEY,
|
||||||
(System.currentTimeMillis() + (expiresInSeconds - 200) * 1000L) + "");
|
(System.currentTimeMillis() + (expiresInSeconds - 200) * 1000L) + "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getJsapiTicket() {
|
public String getJsapiTicket() {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
return jedis.get(JS_API_TICKET_KEY);
|
return jedis.get(JS_API_TICKET_KEY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isJsapiTicketExpired() {
|
public boolean isJsapiTicketExpired() {
|
||||||
|
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
String expiresTimeStr = jedis.get(JS_API_TICKET_EXPIRES_TIME_KEY);
|
String expiresTimeStr = jedis.get(JS_API_TICKET_EXPIRES_TIME_KEY);
|
||||||
|
|
||||||
if (expiresTimeStr != null) {
|
if (expiresTimeStr != null) {
|
||||||
Long expiresTime = Long.parseLong(expiresTimeStr);
|
Long expiresTime = Long.parseLong(expiresTimeStr);
|
||||||
return System.currentTimeMillis() > expiresTime;
|
return System.currentTimeMillis() > expiresTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void expireJsapiTicket() {
|
public void expireJsapiTicket() {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
jedis.set(JS_API_TICKET_EXPIRES_TIME_KEY, "0");
|
jedis.set(JS_API_TICKET_EXPIRES_TIME_KEY, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void updateJsapiTicket(String jsapiTicket, int expiresInSeconds) {
|
public synchronized void updateJsapiTicket(String jsapiTicket, int expiresInSeconds) {
|
||||||
|
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
jedis.set(JS_API_TICKET_KEY, jsapiTicket);
|
jedis.set(JS_API_TICKET_KEY, jsapiTicket);
|
||||||
|
|
||||||
jedis.set(JS_API_TICKET_EXPIRES_TIME_KEY,
|
jedis.set(JS_API_TICKET_EXPIRES_TIME_KEY,
|
||||||
(System.currentTimeMillis() + (expiresInSeconds - 200) * 1000L + ""));
|
(System.currentTimeMillis() + (expiresInSeconds - 200) * 1000L + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCorpId() {
|
public String getCorpId() {
|
||||||
return this.corpId;
|
return this.corpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCorpSecret() {
|
public String getCorpSecret() {
|
||||||
return this.corpSecret;
|
return this.corpSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getAgentId() {
|
public String getAgentId() {
|
||||||
return this.agentId;
|
return this.agentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
return this.token;
|
return this.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAesKey() {
|
public String getAesKey() {
|
||||||
return this.aesKey;
|
return this.aesKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getExpiresTime() {
|
public long getExpiresTime() {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
String expiresTimeStr = jedis.get(ACCESS_TOKEN_EXPIRES_TIME_KEY);
|
String expiresTimeStr = jedis.get(ACCESS_TOKEN_EXPIRES_TIME_KEY);
|
||||||
|
|
||||||
if (expiresTimeStr != null) {
|
if (expiresTimeStr != null) {
|
||||||
Long expiresTime = Long.parseLong(expiresTimeStr);
|
Long expiresTime = Long.parseLong(expiresTimeStr);
|
||||||
return expiresTime;
|
return expiresTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0L;
|
return 0L;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOauth2redirectUri() {
|
public String getOauth2redirectUri() {
|
||||||
return this.oauth2redirectUri;
|
return this.oauth2redirectUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHttpProxyHost() {
|
public String getHttpProxyHost() {
|
||||||
return this.httpProxyHost;
|
return this.httpProxyHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHttpProxyPort() {
|
public int getHttpProxyPort() {
|
||||||
return this.httpProxyPort;
|
return this.httpProxyPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHttpProxyUsername() {
|
public String getHttpProxyUsername() {
|
||||||
return this.httpProxyUsername;
|
return this.httpProxyUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHttpProxyPassword() {
|
public String getHttpProxyPassword() {
|
||||||
return this.httpProxyPassword;
|
return this.httpProxyPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getTmpDirFile() {
|
public File getTmpDirFile() {
|
||||||
return this.tmpDirFile;
|
return this.tmpDirFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApacheHttpClientBuilder getApacheHttpClientBuilder() {
|
public ApacheHttpClientBuilder getApacheHttpClientBuilder() {
|
||||||
return this.apacheHttpClientBuilder;
|
return this.apacheHttpClientBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCorpId(String corpId) {
|
public void setCorpId(String corpId) {
|
||||||
this.corpId = corpId;
|
this.corpId = corpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCorpSecret(String corpSecret) {
|
public void setCorpSecret(String corpSecret) {
|
||||||
this.corpSecret = corpSecret;
|
this.corpSecret = corpSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToken(String token) {
|
public void setToken(String token) {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAesKey(String aesKey) {
|
public void setAesKey(String aesKey) {
|
||||||
this.aesKey = aesKey;
|
this.aesKey = aesKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAgentId(Integer agentId) {
|
public void setAgentId(String agentId) {
|
||||||
this.agentId = agentId;
|
this.agentId = agentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================ Setters below
|
// ============================ Setters below
|
||||||
|
|
||||||
public void setOauth2redirectUri(String oauth2redirectUri) {
|
public void setOauth2redirectUri(String oauth2redirectUri) {
|
||||||
this.oauth2redirectUri = oauth2redirectUri;
|
this.oauth2redirectUri = oauth2redirectUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpProxyHost(String httpProxyHost) {
|
public void setHttpProxyHost(String httpProxyHost) {
|
||||||
this.httpProxyHost = httpProxyHost;
|
this.httpProxyHost = httpProxyHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpProxyPort(int httpProxyPort) {
|
public void setHttpProxyPort(int httpProxyPort) {
|
||||||
this.httpProxyPort = httpProxyPort;
|
this.httpProxyPort = httpProxyPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpProxyUsername(String httpProxyUsername) {
|
public void setHttpProxyUsername(String httpProxyUsername) {
|
||||||
this.httpProxyUsername = httpProxyUsername;
|
this.httpProxyUsername = httpProxyUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHttpProxyPassword(String httpProxyPassword) {
|
public void setHttpProxyPassword(String httpProxyPassword) {
|
||||||
this.httpProxyPassword = httpProxyPassword;
|
this.httpProxyPassword = httpProxyPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTmpDirFile(File tmpDirFile) {
|
public void setTmpDirFile(File tmpDirFile) {
|
||||||
this.tmpDirFile = tmpDirFile;
|
this.tmpDirFile = tmpDirFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApacheHttpClientBuilder(ApacheHttpClientBuilder apacheHttpClientBuilder) {
|
public void setApacheHttpClientBuilder(ApacheHttpClientBuilder apacheHttpClientBuilder) {
|
||||||
this.apacheHttpClientBuilder = apacheHttpClientBuilder;
|
this.apacheHttpClientBuilder = apacheHttpClientBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ public interface WxCpService {
|
|||||||
*
|
*
|
||||||
* @param menu
|
* @param menu
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @see #menuCreate(Integer, WxMenu)
|
* @see #menuCreate(String, me.chanjar.weixin.common.bean.menu.WxMenu)
|
||||||
*/
|
*/
|
||||||
void menuCreate(WxMenu menu) throws WxErrorException;
|
void menuCreate(WxMenu menu) throws WxErrorException;
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ public interface WxCpService {
|
|||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @see #menuCreate(me.chanjar.weixin.common.bean.menu.WxMenu)
|
* @see #menuCreate(me.chanjar.weixin.common.bean.menu.WxMenu)
|
||||||
*/
|
*/
|
||||||
void menuCreate(Integer agentId, WxMenu menu) throws WxErrorException;
|
void menuCreate(String agentId, WxMenu menu) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -188,7 +188,7 @@ public interface WxCpService {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @see #menuDelete(Integer)
|
* @see #menuDelete(String)
|
||||||
*/
|
*/
|
||||||
void menuDelete() throws WxErrorException;
|
void menuDelete() throws WxErrorException;
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ public interface WxCpService {
|
|||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @see #menuDelete()
|
* @see #menuDelete()
|
||||||
*/
|
*/
|
||||||
void menuDelete(Integer agentId) throws WxErrorException;
|
void menuDelete(String agentId) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -215,7 +215,7 @@ public interface WxCpService {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @see #menuGet(Integer)
|
* @see #menuGet(String)
|
||||||
*/
|
*/
|
||||||
WxMenu menuGet() throws WxErrorException;
|
WxMenu menuGet() throws WxErrorException;
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ public interface WxCpService {
|
|||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @see #menuGet()
|
* @see #menuGet()
|
||||||
*/
|
*/
|
||||||
WxMenu menuGet(Integer agentId) throws WxErrorException;
|
WxMenu menuGet(String agentId) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@ -396,12 +396,12 @@ public interface WxCpService {
|
|||||||
* <pre>
|
* <pre>
|
||||||
* 构造oauth2授权的url连接
|
* 构造oauth2授权的url连接
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param state
|
* @param state
|
||||||
* @return url
|
* @return url
|
||||||
*/
|
*/
|
||||||
String oauth2buildAuthorizationUrl(String state);
|
String oauth2buildAuthorizationUrl(String state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
* 构造oauth2授权的url连接
|
* 构造oauth2授权的url连接
|
||||||
@ -425,7 +425,7 @@ public interface WxCpService {
|
|||||||
*
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return [userid, deviceid]
|
* @return [userid, deviceid]
|
||||||
* @see #oauth2getUserInfo(Integer, String)
|
* @see #oauth2getUserInfo(String, String)
|
||||||
*/
|
*/
|
||||||
String[] oauth2getUserInfo(String code) throws WxErrorException;
|
String[] oauth2getUserInfo(String code) throws WxErrorException;
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ public interface WxCpService {
|
|||||||
* @return [userid, deviceid]
|
* @return [userid, deviceid]
|
||||||
* @see #oauth2getUserInfo(String)
|
* @see #oauth2getUserInfo(String)
|
||||||
*/
|
*/
|
||||||
String[] oauth2getUserInfo(Integer agentId, String code) throws WxErrorException;
|
String[] oauth2getUserInfo(String agentId, String code) throws WxErrorException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -191,7 +191,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void menuCreate(Integer agentId, WxMenu menu) throws WxErrorException {
|
public void menuCreate(String agentId, WxMenu menu) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?agentid="
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?agentid="
|
||||||
+ this.configStorage.getAgentId();
|
+ this.configStorage.getAgentId();
|
||||||
post(url, menu.toJson());
|
post(url, menu.toJson());
|
||||||
@ -203,7 +203,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void menuDelete(Integer agentId) throws WxErrorException {
|
public void menuDelete(String agentId) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?agentid=" + agentId;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?agentid=" + agentId;
|
||||||
get(url, null);
|
get(url, null);
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxMenu menuGet(Integer agentId) throws WxErrorException {
|
public WxMenu menuGet(String agentId) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?agentid=" + agentId;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?agentid=" + agentId;
|
||||||
try {
|
try {
|
||||||
String resultContent = get(url, null);
|
String resultContent = get(url, null);
|
||||||
@ -487,7 +487,7 @@ this.configStorage.getOauth2redirectUri(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] oauth2getUserInfo(Integer agentId, String code) throws WxErrorException {
|
public String[] oauth2getUserInfo(String agentId, String code) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?"
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?"
|
||||||
+ "code=" + code
|
+ "code=" + code
|
||||||
+ "&agentid=" + agentId;
|
+ "&agentid=" + agentId;
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package me.chanjar.weixin.cp.bean;
|
package me.chanjar.weixin.cp.bean;
|
||||||
|
|
||||||
import me.chanjar.weixin.cp.bean.messagebuilder.*;
|
|
||||||
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.chanjar.weixin.cp.bean.messagebuilder.FileBuilder;
|
||||||
|
import me.chanjar.weixin.cp.bean.messagebuilder.ImageBuilder;
|
||||||
|
import me.chanjar.weixin.cp.bean.messagebuilder.NewsBuilder;
|
||||||
|
import me.chanjar.weixin.cp.bean.messagebuilder.TextBuilder;
|
||||||
|
import me.chanjar.weixin.cp.bean.messagebuilder.VideoBuilder;
|
||||||
|
import me.chanjar.weixin.cp.bean.messagebuilder.VoiceBuilder;
|
||||||
|
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息
|
* 消息
|
||||||
*
|
*
|
||||||
@ -18,7 +23,7 @@ public class WxCpMessage implements Serializable {
|
|||||||
private String toUser;
|
private String toUser;
|
||||||
private String toParty;
|
private String toParty;
|
||||||
private String toTag;
|
private String toTag;
|
||||||
private Integer agentId;
|
private String agentId;
|
||||||
private String msgType;
|
private String msgType;
|
||||||
private String content;
|
private String content;
|
||||||
private String mediaId;
|
private String mediaId;
|
||||||
@ -96,11 +101,11 @@ public class WxCpMessage implements Serializable {
|
|||||||
this.toTag = toTag;
|
this.toTag = toTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAgentId() {
|
public String getAgentId() {
|
||||||
return this.agentId;
|
return this.agentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAgentId(Integer agentId) {
|
public void setAgentId(String agentId) {
|
||||||
this.agentId = agentId;
|
this.agentId = agentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ import me.chanjar.weixin.cp.bean.WxCpMessage;
|
|||||||
|
|
||||||
public class BaseBuilder<T> {
|
public class BaseBuilder<T> {
|
||||||
protected String msgType;
|
protected String msgType;
|
||||||
protected Integer agentId;
|
protected String agentId;
|
||||||
protected String toUser;
|
protected String toUser;
|
||||||
protected String toParty;
|
protected String toParty;
|
||||||
protected String toTag;
|
protected String toTag;
|
||||||
protected String safe;
|
protected String safe;
|
||||||
|
|
||||||
public T agentId(Integer agentId) {
|
public T agentId(String agentId) {
|
||||||
this.agentId = agentId;
|
this.agentId = agentId;
|
||||||
return (T) this;
|
return (T) this;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user