Skip to content

Commit 97e88bd

Browse files
crazycodebinarywang
authored andcommitted
#1065 支持私有化部署版本的企业微信
通过 wxCpConfigStorage.setBaseApiUrl("http://local_server:port"); 设置私有化部署的企业微信服务地址. 默认值是 https://qyapi.weixin.qq.com , 如果使用默认值,则不需要调用 setBaseApiUrl(baseUrl).
1 parent 6b08dc8 commit 97e88bd

35 files changed

+824
-697
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpAgentService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* @author <a href="https://github.com/huansinho">huansinho</a>
1616
*/
1717
public interface WxCpAgentService {
18-
String GET_AGENT = "https://qyapi.weixin.qq.com/cgi-bin/agent/get?agentid=%d";
19-
String AGENT_SET = "https://qyapi.weixin.qq.com/cgi-bin/agent/set";
20-
String AGENT_LIST = "https://qyapi.weixin.qq.com/cgi-bin/agent/list";
18+
String GET_AGENT = "/cgi-bin/agent/get?agentid=%d";
19+
String AGENT_SET = "/cgi-bin/agent/set";
20+
String AGENT_LIST = "/cgi-bin/agent/list";
2121

2222
/**
2323
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpChatService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
* @author gaigeshen
1313
*/
1414
public interface WxCpChatService {
15-
String APPCHAT_CREATE = "https://qyapi.weixin.qq.com/cgi-bin/appchat/create";
16-
String APPCHAT_UPDATE = "https://qyapi.weixin.qq.com/cgi-bin/appchat/update";
17-
String APPCHAT_GET_CHATID = "https://qyapi.weixin.qq.com/cgi-bin/appchat/get?chatid=";
18-
String APPCHAT_SEND = "https://qyapi.weixin.qq.com/cgi-bin/appchat/send";
15+
String APPCHAT_CREATE = "/cgi-bin/appchat/create";
16+
String APPCHAT_UPDATE = "/cgi-bin/appchat/update";
17+
String APPCHAT_GET_CHATID = "/cgi-bin/appchat/get?chatid=";
18+
String APPCHAT_SEND = "/cgi-bin/appchat/send";
1919

2020
@Deprecated
2121
String chatCreate(String name, String owner, List<String> users, String chatId) throws WxErrorException;

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpDepartmentService.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package me.chanjar.weixin.cp.api;
22

3-
import java.util.List;
4-
53
import me.chanjar.weixin.common.error.WxErrorException;
64
import me.chanjar.weixin.cp.bean.WxCpDepart;
75

6+
import java.util.List;
7+
88
/**
99
* <pre>
1010
* 部门管理接口
@@ -14,10 +14,10 @@
1414
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1515
*/
1616
public interface WxCpDepartmentService {
17-
String DEPARTMENT_CREATE = "https://qyapi.weixin.qq.com/cgi-bin/department/create";
18-
String DEPARTMENT_UPDATE = "https://qyapi.weixin.qq.com/cgi-bin/department/update";
19-
String DEPARTMENT_DELETE = "https://qyapi.weixin.qq.com/cgi-bin/department/delete?id=%d";
20-
String DEPARTMENT_LIST = "https://qyapi.weixin.qq.com/cgi-bin/department/list";
17+
String DEPARTMENT_CREATE = "/cgi-bin/department/create";
18+
String DEPARTMENT_UPDATE = "/cgi-bin/department/update";
19+
String DEPARTMENT_DELETE = "/cgi-bin/department/delete?id=%d";
20+
String DEPARTMENT_LIST = "/cgi-bin/department/list";
2121

2222
/**
2323
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMediaService.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package me.chanjar.weixin.cp.api;
22

3+
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
4+
import me.chanjar.weixin.common.error.WxErrorException;
5+
36
import java.io.File;
47
import java.io.IOException;
58
import java.io.InputStream;
69

7-
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
8-
import me.chanjar.weixin.common.error.WxErrorException;
9-
1010
/**
1111
* <pre>
1212
* 媒体管理接口.
@@ -16,10 +16,10 @@
1616
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1717
*/
1818
public interface WxCpMediaService {
19-
String MEDIA_GET_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/get";
20-
String MEDIA_UPLOAD_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/upload?type=";
21-
String IMG_UPLOAD_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/uploadimg";
22-
String JSSDK_MEDIA_GET_URL = "https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk";
19+
String MEDIA_GET_URL = "/cgi-bin/media/get";
20+
String MEDIA_UPLOAD_URL = "/cgi-bin/media/upload?type=";
21+
String IMG_UPLOAD_URL = "/cgi-bin/media/uploadimg";
22+
String JSSDK_MEDIA_GET_URL = "/cgi-bin/media/get/jssdk";
2323

2424
/**
2525
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMenuService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1313
*/
1414
public interface WxCpMenuService {
15-
String MENU_CREATE = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?agentid=%d";
16-
String MENU_DELETE = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?agentid=%d";
17-
String MENU_GET = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?agentid=%d";
15+
String MENU_CREATE = "/cgi-bin/menu/create?agentid=%d";
16+
String MENU_DELETE = "/cgi-bin/menu/delete?agentid=%d";
17+
String MENU_GET = "/cgi-bin/menu/get?agentid=%d";
1818

1919
/**
2020
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOAuth2Service.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1414
*/
1515
public interface WxCpOAuth2Service {
16-
String URL_GET_USER_INFO = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?code=%s&agentid=%d";
17-
String URL_GET_USER_DETAIL = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserdetail";
16+
String URL_GET_USER_INFO = "/cgi-bin/user/getuserinfo?code=%s&agentid=%d";
17+
String URL_GET_USER_DETAIL = "/cgi-bin/user/getuserdetail";
1818
String URL_OAUTH_2_AUTHORIZE = "https://open.weixin.qq.com/connect/oauth2/authorize";
1919

2020
/**

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOaService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
* @date 2019-04-06 10:52
1717
*/
1818
public interface WxCpOaService {
19-
String GET_CHECKIN_DATA = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata";
20-
String GET_CHECKIN_OPTION = "https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckinoption";
21-
String GET_APPROVAL_DATA = "https://qyapi.weixin.qq.com/cgi-bin/corp/getapprovaldata";
22-
String GET_DIAL_RECORD = "https://qyapi.weixin.qq.com/cgi-bin/dial/get_dial_record";
19+
String GET_CHECKIN_DATA = "/cgi-bin/checkin/getcheckindata";
20+
String GET_CHECKIN_OPTION = "/cgi-bin/checkin/getcheckinoption";
21+
String GET_APPROVAL_DATA = "/cgi-bin/corp/getapprovaldata";
22+
String GET_DIAL_RECORD = "/cgi-bin/dial/get_dial_record";
2323

2424
/**
2525
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
* @author chanjaster
1818
*/
1919
public interface WxCpService {
20-
String GET_JSAPI_TICKET = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket";
21-
String GET_AGENT_CONFIG_TICKET = "https://qyapi.weixin.qq.com/cgi-bin/ticket/get?&type=agent_config";
22-
String MESSAGE_SEND = "https://qyapi.weixin.qq.com/cgi-bin/message/send";
23-
String GET_CALLBACK_IP = "https://qyapi.weixin.qq.com/cgi-bin/getcallbackip";
24-
String BATCH_REPLACE_PARTY = "https://qyapi.weixin.qq.com/cgi-bin/batch/replaceparty";
25-
String BATCH_REPLACE_USER = "https://qyapi.weixin.qq.com/cgi-bin/batch/replaceuser";
26-
String BATCH_GET_RESULT = "https://qyapi.weixin.qq.com/cgi-bin/batch/getresult?jobid=";
27-
String JSCODE_TO_SESSION_URL = "https://qyapi.weixin.qq.com/cgi-bin/miniprogram/jscode2session";
28-
String GET_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?&corpid=%s&corpsecret=%s";
20+
String GET_JSAPI_TICKET = "/cgi-bin/get_jsapi_ticket";
21+
String GET_AGENT_CONFIG_TICKET = "/cgi-bin/ticket/get?&type=agent_config";
22+
String MESSAGE_SEND = "/cgi-bin/message/send";
23+
String GET_CALLBACK_IP = "/cgi-bin/getcallbackip";
24+
String BATCH_REPLACE_PARTY = "/cgi-bin/batch/replaceparty";
25+
String BATCH_REPLACE_USER = "/cgi-bin/batch/replaceuser";
26+
String BATCH_GET_RESULT = "/cgi-bin/batch/getresult?jobid=";
27+
String JSCODE_TO_SESSION_URL = "/cgi-bin/miniprogram/jscode2session";
28+
String GET_TOKEN = "/cgi-bin/gettoken?&corpid=%s&corpsecret=%s";
2929

3030
/**
3131
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpTagService.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1818
*/
1919
public interface WxCpTagService {
20-
String TAG_CREATE = "https://qyapi.weixin.qq.com/cgi-bin/tag/create";
21-
String TAG_UPDATE = "https://qyapi.weixin.qq.com/cgi-bin/tag/update";
22-
String TAG_DELETE = "https://qyapi.weixin.qq.com/cgi-bin/tag/delete?tagid=%s";
23-
String TAG_LIST = "https://qyapi.weixin.qq.com/cgi-bin/tag/list";
24-
String TAG_GET = "https://qyapi.weixin.qq.com/cgi-bin/tag/get?tagid=%s";
25-
String TAG_ADDTAGUSERS = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers";
26-
String TAG_DELTAGUSERS = "https://qyapi.weixin.qq.com/cgi-bin/tag/deltagusers";
20+
String TAG_CREATE = "/cgi-bin/tag/create";
21+
String TAG_UPDATE = "/cgi-bin/tag/update";
22+
String TAG_DELETE = "/cgi-bin/tag/delete?tagid=%s";
23+
String TAG_LIST = "/cgi-bin/tag/list";
24+
String TAG_GET = "/cgi-bin/tag/get?tagid=%s";
25+
String TAG_ADDTAGUSERS = "/cgi-bin/tag/addtagusers";
26+
String TAG_DELTAGUSERS = "/cgi-bin/tag/deltagusers";
2727

2828
/**
2929
* 创建标签.

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpTaskCardService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @date 2019-05-16
1515
*/
1616
public interface WxCpTaskCardService {
17-
String MESSAGE_UPDATE_TASKCARD = "https://qyapi.weixin.qq.com/cgi-bin/message/update_taskcard";
17+
String MESSAGE_UPDATE_TASKCARD = "/cgi-bin/message/update_taskcard";
1818

1919
/**
2020
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpTpService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
* @author zhenjun cai
1616
*/
1717
public interface WxCpTpService {
18-
String JSCODE_TO_SESSION_URL = "https://qyapi.weixin.qq.com/cgi-bin/service/miniprogram/jscode2session";
19-
String GET_CORP_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/service/get_corp_token";
20-
String GET_PERMANENT_CODE = "https://qyapi.weixin.qq.com/cgi-bin/service/get_permanent_code";
21-
String GET_SUITE_TOKEN = "https://qyapi.weixin.qq.com/cgi-bin/service/get_suite_token";
18+
String JSCODE_TO_SESSION_URL = "/cgi-bin/service/miniprogram/jscode2session";
19+
String GET_CORP_TOKEN = "/cgi-bin/service/get_corp_token";
20+
String GET_PERMANENT_CODE = "/cgi-bin/service/get_permanent_code";
21+
String GET_SUITE_TOKEN = "/cgi-bin/service/get_suite_token";
2222

2323
/**
2424
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpUserService.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package me.chanjar.weixin.cp.api;
22

3-
import java.util.List;
4-
import java.util.Map;
5-
63
import me.chanjar.weixin.common.error.WxErrorException;
74
import me.chanjar.weixin.cp.bean.WxCpInviteResult;
85
import me.chanjar.weixin.cp.bean.WxCpUser;
96
import me.chanjar.weixin.cp.bean.WxCpUserExternalContactInfo;
107

8+
import java.util.List;
9+
import java.util.Map;
10+
1111
/**
1212
* <pre>
1313
* 用户管理接口
@@ -17,18 +17,18 @@
1717
* @author <a href="https://github.com/binarywang">Binary Wang</a>
1818
*/
1919
public interface WxCpUserService {
20-
String URL_AUTHENTICATE = "https://qyapi.weixin.qq.com/cgi-bin/user/authsucc?userid=";
21-
String URL_USER_CREATE = "https://qyapi.weixin.qq.com/cgi-bin/user/create";
22-
String URL_USER_UPDATE = "https://qyapi.weixin.qq.com/cgi-bin/user/update";
23-
String URL_USER_DELETE = "https://qyapi.weixin.qq.com/cgi-bin/user/delete?userid=";
24-
String URL_USER_BATCH_DELETE = "https://qyapi.weixin.qq.com/cgi-bin/user/batchdelete";
25-
String URL_USER_GET = "https://qyapi.weixin.qq.com/cgi-bin/user/get?userid=";
26-
String URL_USER_LIST = "https://qyapi.weixin.qq.com/cgi-bin/user/list?department_id=";
27-
String URL_USER_SIMPLE_LIST = "https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?department_id=";
28-
String URL_BATCH_INVITE = "https://qyapi.weixin.qq.com/cgi-bin/batch/invite";
29-
String URL_CONVERT_TO_OPENID = "https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_openid";
30-
String URL_CONVERT_TO_USERID = "https://qyapi.weixin.qq.com/cgi-bin/user/convert_to_userid";
31-
String URL_GET_EXTERNAL_CONTACT = "https://qyapi.weixin.qq.com/cgi-bin/crm/get_external_contact?external_userid=";
20+
String URL_AUTHENTICATE = "/cgi-bin/user/authsucc?userid=";
21+
String URL_USER_CREATE = "/cgi-bin/user/create";
22+
String URL_USER_UPDATE = "/cgi-bin/user/update";
23+
String URL_USER_DELETE = "/cgi-bin/user/delete?userid=";
24+
String URL_USER_BATCH_DELETE = "/cgi-bin/user/batchdelete";
25+
String URL_USER_GET = "/cgi-bin/user/get?userid=";
26+
String URL_USER_LIST = "/cgi-bin/user/list?department_id=";
27+
String URL_USER_SIMPLE_LIST = "/cgi-bin/user/simplelist?department_id=";
28+
String URL_BATCH_INVITE = "/cgi-bin/batch/invite";
29+
String URL_CONVERT_TO_OPENID = "/cgi-bin/user/convert_to_openid";
30+
String URL_CONVERT_TO_USERID = "/cgi-bin/user/convert_to_userid";
31+
String URL_GET_EXTERNAL_CONTACT = "/cgi-bin/crm/get_external_contact?external_userid=";
3232

3333
/**
3434
* <pre>

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImpl.java

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@
1818
import me.chanjar.weixin.common.util.http.RequestHttp;
1919
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
2020
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
21-
import me.chanjar.weixin.cp.api.*;
21+
import me.chanjar.weixin.cp.api.WxCpAgentService;
22+
import me.chanjar.weixin.cp.api.WxCpChatService;
23+
import me.chanjar.weixin.cp.api.WxCpDepartmentService;
24+
import me.chanjar.weixin.cp.api.WxCpMediaService;
25+
import me.chanjar.weixin.cp.api.WxCpMenuService;
26+
import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
27+
import me.chanjar.weixin.cp.api.WxCpOaService;
28+
import me.chanjar.weixin.cp.api.WxCpService;
29+
import me.chanjar.weixin.cp.api.WxCpTagService;
30+
import me.chanjar.weixin.cp.api.WxCpTaskCardService;
31+
import me.chanjar.weixin.cp.api.WxCpUserService;
2232
import me.chanjar.weixin.cp.bean.WxCpMaJsCode2SessionResult;
2333
import me.chanjar.weixin.cp.bean.WxCpMessage;
2434
import me.chanjar.weixin.cp.bean.WxCpMessageSendResult;
@@ -37,16 +47,16 @@
3747
public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestHttp<H, P> {
3848
protected final Logger log = LoggerFactory.getLogger(this.getClass());
3949

40-
private WxCpUserService userService = new WxCpUserServiceImpl(this);
41-
private WxCpChatService chatService = new WxCpChatServiceImpl(this);
50+
private WxCpUserService userService = new WxCpUserServiceImpl(this);
51+
private WxCpChatService chatService = new WxCpChatServiceImpl(this);
4252
private WxCpDepartmentService departmentService = new WxCpDepartmentServiceImpl(this);
43-
private WxCpMediaService mediaService = new WxCpMediaServiceImpl(this);
44-
private WxCpMenuService menuService = new WxCpMenuServiceImpl(this);
45-
private WxCpOAuth2Service oauth2Service = new WxCpOAuth2ServiceImpl(this);
46-
private WxCpTagService tagService = new WxCpTagServiceImpl(this);
47-
private WxCpAgentService agentService = new WxCpAgentServiceImpl(this);
48-
private WxCpOaService oaService = new WxCpOaServiceImpl(this);
49-
private WxCpTaskCardService taskCardService = new WxCpTaskCardServiceImpl(this);
53+
private WxCpMediaService mediaService = new WxCpMediaServiceImpl(this);
54+
private WxCpMenuService menuService = new WxCpMenuServiceImpl(this);
55+
private WxCpOAuth2Service oauth2Service = new WxCpOAuth2ServiceImpl(this);
56+
private WxCpTagService tagService = new WxCpTagServiceImpl(this);
57+
private WxCpAgentService agentService = new WxCpAgentServiceImpl(this);
58+
private WxCpOaService oaService = new WxCpOaServiceImpl(this);
59+
private WxCpTaskCardService taskCardService = new WxCpTaskCardServiceImpl(this);
5060

5161
/**
5262
* 全局的是否正在刷新access token的锁
@@ -104,7 +114,7 @@ public String getAgentJsapiTicket(boolean forceRefresh) throws WxErrorException
104114
if (this.configStorage.isAgentJsapiTicketExpired()) {
105115
synchronized (this.globalAgentJsapiTicketRefreshLock) {
106116
if (this.configStorage.isAgentJsapiTicketExpired()) {
107-
String responseContent = this.get(WxCpService.GET_AGENT_CONFIG_TICKET, null);
117+
String responseContent = this.get(this.configStorage.getApiUrl(WxCpService.GET_AGENT_CONFIG_TICKET), null);
108118
JsonObject jsonObject = new JsonParser().parse(responseContent).getAsJsonObject();
109119
this.configStorage.updateAgentJsapiTicket(jsonObject.get("ticket").getAsString(),
110120
jsonObject.get("expires_in").getAsInt());
@@ -129,7 +139,7 @@ public String getJsapiTicket(boolean forceRefresh) throws WxErrorException {
129139
if (this.configStorage.isJsapiTicketExpired()) {
130140
synchronized (this.globalJsapiTicketRefreshLock) {
131141
if (this.configStorage.isJsapiTicketExpired()) {
132-
String responseContent = this.get(WxCpService.GET_JSAPI_TICKET, null);
142+
String responseContent = this.get(this.configStorage.getApiUrl(WxCpService.GET_JSAPI_TICKET), null);
133143
JsonObject tmpJsonObject = new JsonParser().parse(responseContent).getAsJsonObject();
134144
this.configStorage.updateJsapiTicket(tmpJsonObject.get("ticket").getAsString(),
135145
tmpJsonObject.get("expires_in").getAsInt());
@@ -170,7 +180,7 @@ public WxCpMessageSendResult messageSend(WxCpMessage message) throws WxErrorExce
170180
message.setAgentId(this.getWxCpConfigStorage().getAgentId());
171181
}
172182

173-
return WxCpMessageSendResult.fromJson(this.post(WxCpService.MESSAGE_SEND, message.toJson()));
183+
return WxCpMessageSendResult.fromJson(this.post(this.configStorage.getApiUrl(WxCpService.MESSAGE_SEND), message.toJson()));
174184
}
175185

176186
@Override
@@ -179,13 +189,13 @@ public WxCpMaJsCode2SessionResult jsCode2Session(String jsCode) throws WxErrorEx
179189
params.put("js_code", jsCode);
180190
params.put("grant_type", "authorization_code");
181191

182-
String result = this.get(JSCODE_TO_SESSION_URL, Joiner.on("&").withKeyValueSeparator("=").join(params));
192+
String result = this.get(this.configStorage.getApiUrl(JSCODE_TO_SESSION_URL), Joiner.on("&").withKeyValueSeparator("=").join(params));
183193
return WxCpMaJsCode2SessionResult.fromJson(result);
184194
}
185195

186196
@Override
187197
public String[] getCallbackIp() throws WxErrorException {
188-
String responseContent = get(WxCpService.GET_CALLBACK_IP, null);
198+
String responseContent = get(this.configStorage.getApiUrl(WxCpService.GET_CALLBACK_IP), null);
189199
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
190200
JsonArray jsonArray = tmpJsonElement.getAsJsonObject().get("ip_list").getAsJsonArray();
191201
String[] ips = new String[jsonArray.size()];
@@ -329,19 +339,19 @@ public WxSessionManager getSessionManager() {
329339
public String replaceParty(String mediaId) throws WxErrorException {
330340
JsonObject jsonObject = new JsonObject();
331341
jsonObject.addProperty("media_id", mediaId);
332-
return post(WxCpService.BATCH_REPLACE_PARTY, jsonObject.toString());
342+
return post(this.configStorage.getApiUrl(WxCpService.BATCH_REPLACE_PARTY), jsonObject.toString());
333343
}
334344

335345
@Override
336346
public String replaceUser(String mediaId) throws WxErrorException {
337347
JsonObject jsonObject = new JsonObject();
338348
jsonObject.addProperty("media_id", mediaId);
339-
return post(WxCpService.BATCH_REPLACE_USER, jsonObject.toString());
349+
return post(this.configStorage.getApiUrl(WxCpService.BATCH_REPLACE_USER), jsonObject.toString());
340350
}
341351

342352
@Override
343353
public String getTaskResult(String joinId) throws WxErrorException {
344-
String url = WxCpService.BATCH_GET_RESULT + joinId;
354+
String url = this.configStorage.getApiUrl(WxCpService.BATCH_GET_RESULT + joinId);
345355
return get(url, null);
346356
}
347357

0 commit comments

Comments
 (0)