From a357d794b6800df4c14d755b8d5576f8c9062712 Mon Sep 17 00:00:00 2001 From: vostro2013 Date: Thu, 8 Jun 2023 12:36:33 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#3040=20=E3=80=90=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E3=80=91=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E7=B1=BB=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=90=8C=E6=97=B6=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20(=E6=9F=A5=E8=AF=A2=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=BA=BF=E4=B8=8A=E4=BB=A3=E7=A0=81=E7=9A=84=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E7=8A=B6=E6=80=81=EF=BC=8C=E8=8E=B7=E5=8F=96=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E4=B8=9A=E5=8A=A1=E5=9F=9F=E5=90=8D=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E6=96=87=E4=BB=B6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/open/api/WxOpenMaService.java | 30 +++++++++++- .../open/api/impl/WxOpenMaServiceImpl.java | 11 +++++ .../WxOpenMaDomainConfirmFileResult.java | 32 +++++++++++++ .../bean/result/WxOpenMaDomainResult.java | 48 ++++++++++++++++--- .../bean/result/WxOpenMaQueryAuditResult.java | 15 ++++++ .../result/WxOpenMaVisitStatusResult.java | 21 ++++++++ 6 files changed, 148 insertions(+), 9 deletions(-) create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainConfirmFileResult.java create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaVisitStatusResult.java diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java index ca11627ba..9e3156a1b 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java @@ -42,6 +42,11 @@ public interface WxOpenMaService extends WxMaService { */ String API_SET_WEBVIEW_DOMAIN = "https://api.weixin.qq.com/wxa/setwebviewdomain"; + /** + * 获取业务域名校验文件(仅供第三方代小程序调用) + */ + String API_GET_WEBVIEW_DOMAIN_CONFIRM_FILE = "https://api.weixin.qq.com/wxa/get_webviewdomain_confirmfile"; + /** * 获取帐号基本信息 *
@@ -138,10 +143,15 @@ public interface WxOpenMaService extends WxMaService {
   String API_RELEASE = "https://api.weixin.qq.com/wxa/release";
 
   /**
-   * 10. 修改小程序线上代码的可见状态(仅供第三方代小程序调用)
+   * 10.1 修改小程序线上代码的可见状态(仅供第三方代小程序调用)
    */
   String API_CHANGE_VISITSTATUS = "https://api.weixin.qq.com/wxa/change_visitstatus";
 
+  /**
+   * 10.2 查询小程序线上代码的可见状态(仅供第三方代小程序调用)
+   */
+  String API_GET_VISITSTATUS = "https://api.weixin.qq.com/wxa/getvisitstatus";
+
   /**
    * 11.小程序版本回退(仅供第三方代小程序调用)
    */
@@ -315,6 +325,14 @@ public interface WxOpenMaService extends WxMaService {
    */
   WxOpenMaWebDomainResult setWebViewDomainInfo(String action, List domainList) throws WxErrorException;
 
+  /**
+   * 获取业务域名校验文件
+   *
+   * @return 业务域名校验文件信息
+   * @throws WxErrorException 操作失败时抛出,具体错误码请看文档
+   */
+  WxOpenMaDomainConfirmFileResult getWebviewDomainConfirmFile() throws WxErrorException;
+
   /**
    * 获取小程序的信息
    *
@@ -477,7 +495,7 @@ public interface WxOpenMaService extends WxMaService {
   WxOpenResult releaseAudited() throws WxErrorException;
 
   /**
-   * 10. 修改小程序线上代码的可见状态(仅供第三方代小程序调用)
+   * 10.1 修改小程序线上代码的可见状态(仅供第三方代小程序调用)
    *
    * @param action the action
    * @return the wx open result
@@ -485,6 +503,14 @@ public interface WxOpenMaService extends WxMaService {
    */
   WxOpenResult changeVisitStatus(String action) throws WxErrorException;
 
+  /**
+   * 10.2 查询小程序服务状态(仅供第三方代小程序调用)
+   *
+   * @return 小程序服务状态
+   * @throws WxErrorException 查询失败时返回,具体错误码请看此接口的注释文档
+   */
+  WxOpenMaVisitStatusResult getVisitStatus() throws WxErrorException;
+
   /**
    * 11. 小程序版本回退(仅供第三方代小程序调用)
    *
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java
index faab12503..5c5e6f65e 100644
--- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java
@@ -120,6 +120,11 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
     return WxMaGsonBuilder.create().fromJson(response, WxOpenMaWebDomainResult.class);
   }
 
+  @Override
+  public WxOpenMaDomainConfirmFileResult getWebviewDomainConfirmFile() throws WxErrorException {
+    String responseContent = post(API_GET_WEBVIEW_DOMAIN_CONFIRM_FILE, "{}");
+    return WxOpenMaDomainConfirmFileResult.fromJson(responseContent);
+  }
 
   @Override
   public String getAccountBasicInfo() throws WxErrorException {
@@ -255,6 +260,12 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
     return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
   }
 
+  @Override
+  public WxOpenMaVisitStatusResult getVisitStatus() throws WxErrorException {
+    String responseContent = post(API_GET_VISITSTATUS, "{}");
+    return WxOpenMaVisitStatusResult.fromJson(responseContent);
+  }
+
   @Override
   public WxOpenResult revertCodeRelease() throws WxErrorException {
     String response = get(API_REVERT_CODE_RELEASE, null);
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainConfirmFileResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainConfirmFileResult.java
new file mode 100644
index 000000000..595c298f4
--- /dev/null
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainConfirmFileResult.java
@@ -0,0 +1,32 @@
+package me.chanjar.weixin.open.bean.result;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+/**
+ * 业务域名校验文件
+ *
+ * @author vostro2013
+ * @date 2023/06/06
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WxOpenMaDomainConfirmFileResult extends WxOpenResult {
+  /**
+   * 文件名
+   */
+  @SerializedName("file_name")
+  private String fileName;
+
+  /**
+   * 文件内容
+   */
+  @SerializedName("file_content")
+  private String fileContent;
+
+  public static WxOpenMaDomainConfirmFileResult fromJson(String json) {
+    return WxGsonBuilder.create().fromJson(json, WxOpenMaDomainConfirmFileResult.class);
+  }
+}
\ No newline at end of file
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainResult.java
index 86879f7a6..028dd62e2 100644
--- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainResult.java
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainResult.java
@@ -3,6 +3,7 @@ package me.chanjar.weixin.open.bean.result;
 import com.google.gson.annotations.SerializedName;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
 
 import java.util.List;
 
@@ -17,16 +18,49 @@ import java.util.List;
 public class WxOpenMaDomainResult extends WxOpenResult {
   private static final long serialVersionUID = 3406315629639573330L;
 
+  /**
+   * request合法域名
+   */
   @SerializedName("requestdomain")
-  List requestdomainList;
-
+  private List requestDomain;
+  /**
+   * socket合法域名
+   */
   @SerializedName("wsrequestdomain")
-  List wsrequestdomainList;
-
+  private List wsRequestDomain;
+  /**
+   * uploadFile合法域名
+   */
   @SerializedName("uploaddomain")
-  List uploaddomainList;
-
+  private List uploadDomain;
+  /**
+   * downloadFile合法域名
+   */
   @SerializedName("downloaddomain")
-  List downloaddomainList;
+  private List downloadDomain;
+  /**
+   * request不合法域名
+   */
+  @SerializedName("invalid_requestdomain")
+  private List invalidRequestDomain;
+  /**
+   * socket不合法域名
+   */
+  @SerializedName("invalid_wsrequestdomain")
+  private List invalidWsRequestDomain;
+  /**
+   * uploadFile不合法域名
+   */
+  @SerializedName("invalid_uploaddomain")
+  private List invalidUploadDomain;
+  /**
+   * downloadFile不合法域名
+   */
+  @SerializedName("invalid_downloaddomain")
+  private List invalidDownloadDomain;
+
+  public static WxOpenMaDomainResult fromJson(String json) {
+    return WxGsonBuilder.create().fromJson(json, WxOpenMaDomainResult.class);
+  }
 
 }
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaQueryAuditResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaQueryAuditResult.java
index de5167d32..7b50b6e32 100644
--- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaQueryAuditResult.java
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaQueryAuditResult.java
@@ -35,4 +35,19 @@ public class WxOpenMaQueryAuditResult extends WxOpenResult {
    */
   @SerializedName(value = "screenshot")
   private String screenShot;
+  /**
+   * 审核版本
+   */
+  @SerializedName("user_version")
+  private String userVersion;
+  /**
+   * 版本描述
+   */
+  @SerializedName("user_desc")
+  private String userDesc;
+  /**
+   * 时间戳,提交审核的时间
+   */
+  @SerializedName("submit_audit_time")
+  private Long submitAuditTime;
 }
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaVisitStatusResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaVisitStatusResult.java
new file mode 100644
index 000000000..c319e89ac
--- /dev/null
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaVisitStatusResult.java
@@ -0,0 +1,21 @@
+package me.chanjar.weixin.open.bean.result;
+
+import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 小程序服务状态
+ *
+ * @author vostro2013
+ * @date 2023/06/06
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class WxOpenMaVisitStatusResult extends WxOpenResult {
+  private Integer status;
+
+  public static WxOpenMaVisitStatusResult fromJson(String json) {
+    return WxMaGsonBuilder.create().fromJson(json, WxOpenMaVisitStatusResult.class);
+  }
+}
\ No newline at end of file