1
0
mirror of synced 2025-12-17 04:43:15 +08:00

🎨 #3182 【开放平台】 设置服务器域名接口方法增加tcp合法域名和 udp合法域名的参数

This commit is contained in:
Binary Wang
2023-12-09 12:06:53 +08:00
parent 20549a93e4
commit 9db584135c
2 changed files with 28 additions and 20 deletions

View File

@@ -277,17 +277,20 @@ public interface WxOpenMaService extends WxMaService {
/** /**
* 修改域名 * 修改域名
* * <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/Server_Address_Configuration.html">文档地址</a>
* @param action delete删除, set覆盖, get获取 * @param action delete删除, set覆盖, get获取
* @param requestDomains the requestdomain list * @param requestDomains request 合法域名;当 action 是 get 时不需要此字段
* @param wsRequestDomains the wsrequestdomain list * @param wsRequestDomains socket 合法域名;当 action 是 get 时不需要此字段
* @param uploadDomains the uploaddomain list * @param uploadDomains uploadFile 合法域名;当 action 是 get 时不需要此字段
* @param downloadDomains the downloaddomain list * @param downloadDomains downloadFile 合法域名;当 action 是 get 时不需要此字段
* @param tcpDomains tcp 合法域名;当 action 是 get 时不需要此字段
* @param udpDomains udp 合法域名;当 action 是 get 时不需要此字段
* @return the wx open ma domain result * @return the wx open ma domain result
* @throws WxErrorException the wx error exception * @throws WxErrorException the wx error exception
*/ */
WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, List<String> wsRequestDomains, WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, List<String> wsRequestDomains,
List<String> uploadDomains, List<String> downloadDomains) throws WxErrorException; List<String> uploadDomains, List<String> downloadDomains,
List<String> udpDomains, List<String> tcpDomains) throws WxErrorException;
/** /**
* 获取小程序的业务域名 * 获取小程序的业务域名

View File

@@ -36,6 +36,8 @@ import java.util.Map;
* created on 2018-09-12 * created on 2018-09-12
*/ */
public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaService { public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaService {
private static final String ACTION = "action";
private static final String ACTION_GET = "get";
private final WxOpenComponentService wxOpenComponentService; private final WxOpenComponentService wxOpenComponentService;
private final WxMaConfig wxMaConfig; private final WxMaConfig wxMaConfig;
private final String appId; private final String appId;
@@ -73,41 +75,44 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
@Override @Override
public WxOpenMaDomainResult getDomain() throws WxErrorException { public WxOpenMaDomainResult getDomain() throws WxErrorException {
return modifyDomain("get", null, null, null, null); return modifyDomain(ACTION_GET, null, null, null,
null, null, null);
} }
@Override @Override
public WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, List<String> wsRequestDomains, List<String> uploadDomains, List<String> downloadDomains) throws WxErrorException { public WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, List<String> wsRequestDomains,
// if (!"get".equals(action) && (requestdomainList == null || wsrequestdomainList == null || uploaddomainList == null || downloaddomainList == null)) { List<String> uploadDomains, List<String> downloadDomains,
// throw new WxErrorException(WxError.builder().errorCode(44004).errorMsg("域名参数不能为空").build()); List<String> udpDomains, List<String> tcpDomains) throws WxErrorException {
// }
JsonObject requestJson = new JsonObject(); JsonObject requestJson = new JsonObject();
requestJson.addProperty("action", action); requestJson.addProperty(ACTION, action);
if (!"get".equals(action)) { if (!ACTION_GET.equals(action)) {
requestJson.add("requestdomain", toJsonArray(requestDomains)); requestJson.add("requestdomain", toJsonArray(requestDomains));
requestJson.add("wsrequestdomain", toJsonArray(wsRequestDomains)); requestJson.add("wsrequestdomain", toJsonArray(wsRequestDomains));
requestJson.add("uploaddomain", toJsonArray(uploadDomains)); requestJson.add("uploaddomain", toJsonArray(uploadDomains));
requestJson.add("downloaddomain", toJsonArray(downloadDomains)); requestJson.add("downloaddomain", toJsonArray(downloadDomains));
requestJson.add("udpdomain", toJsonArray(udpDomains));
requestJson.add("tcpdomain", toJsonArray(tcpDomains));
} }
String response = post(API_MODIFY_DOMAIN, GSON.toJson(requestJson)); String response = post(API_MODIFY_DOMAIN, GSON.toJson(requestJson));
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaDomainResult.class); return WxMaGsonBuilder.create().fromJson(response, WxOpenMaDomainResult.class);
} }
@Override @Override
public String getWebViewDomain() throws WxErrorException { public String getWebViewDomain() throws WxErrorException {
return setWebViewDomain("get", null); return setWebViewDomain(ACTION_GET, null);
} }
@Override @Override
public WxOpenMaWebDomainResult getWebViewDomainInfo() throws WxErrorException { public WxOpenMaWebDomainResult getWebViewDomainInfo() throws WxErrorException {
return setWebViewDomainInfo("get", null); return setWebViewDomainInfo(ACTION_GET, null);
} }
@Override @Override
public String setWebViewDomain(String action, List<String> domainList) throws WxErrorException { public String setWebViewDomain(String action, List<String> domainList) throws WxErrorException {
JsonObject requestJson = new JsonObject(); JsonObject requestJson = new JsonObject();
requestJson.addProperty("action", action); requestJson.addProperty(ACTION, action);
if (!"get".equals(action)) { if (!ACTION_GET.equals(action)) {
requestJson.add("webviewdomain", toJsonArray(domainList)); requestJson.add("webviewdomain", toJsonArray(domainList));
} }
return post(API_SET_WEBVIEW_DOMAIN, GSON.toJson(requestJson)); return post(API_SET_WEBVIEW_DOMAIN, GSON.toJson(requestJson));
@@ -159,7 +164,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
@Override @Override
public WxOpenMaTesterListResult getTesterList() throws WxErrorException { public WxOpenMaTesterListResult getTesterList() throws WxErrorException {
JsonObject paramJson = new JsonObject(); JsonObject paramJson = new JsonObject();
paramJson.addProperty("action", "get_experiencer"); paramJson.addProperty(ACTION, "get_experiencer");
String response = post(API_GET_TESTERLIST, GSON.toJson(paramJson)); String response = post(API_GET_TESTERLIST, GSON.toJson(paramJson));
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaTesterListResult.class); return WxMaGsonBuilder.create().fromJson(response, WxOpenMaTesterListResult.class);
} }
@@ -255,7 +260,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
@Override @Override
public WxOpenResult changeVisitStatus(String action) throws WxErrorException { public WxOpenResult changeVisitStatus(String action) throws WxErrorException {
JsonObject params = new JsonObject(); JsonObject params = new JsonObject();
params.addProperty("action", action); params.addProperty(ACTION, action);
String response = post(API_CHANGE_VISITSTATUS, GSON.toJson(params)); String response = post(API_CHANGE_VISITSTATUS, GSON.toJson(params));
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class); return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
} }
@@ -450,7 +455,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
@Override @Override
public WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException { public WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException {
JsonObject params = new JsonObject(); JsonObject params = new JsonObject();
params.addProperty("action", "apply"); params.addProperty(ACTION, "apply");
String response = post(API_WX_APPLY_LIVE_INFO, GSON.toJson(params)); String response = post(API_WX_APPLY_LIVE_INFO, GSON.toJson(params));
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaApplyLiveInfoResult.class); return WxMaGsonBuilder.create().fromJson(response, WxOpenMaApplyLiveInfoResult.class);
} }