mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-03 12:17:46 +08:00
🆕 #2831 【开放平台】新增小程序DNS预解析域名相关接口
This commit is contained in:
parent
3bd517a007
commit
d759317396
@ -3,6 +3,7 @@ package me.chanjar.weixin.open.api;
|
|||||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||||
import cn.binarywang.wx.miniapp.bean.WxMaAuditMediaUploadResult;
|
import cn.binarywang.wx.miniapp.bean.WxMaAuditMediaUploadResult;
|
||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
|
import me.chanjar.weixin.open.bean.ma.WxMaPrefetchDomain;
|
||||||
import me.chanjar.weixin.open.bean.ma.WxMaScheme;
|
import me.chanjar.weixin.open.bean.ma.WxMaScheme;
|
||||||
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
|
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
|
||||||
import me.chanjar.weixin.open.bean.result.*;
|
import me.chanjar.weixin.open.bean.result.*;
|
||||||
@ -256,6 +257,16 @@ public interface WxOpenMaService extends WxMaService {
|
|||||||
*/
|
*/
|
||||||
String API_GET_VERSION_INFO = "https://api.weixin.qq.com/wxa/getversioninfo";
|
String API_GET_VERSION_INFO = "https://api.weixin.qq.com/wxa/getversioninfo";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置DNS预解析域名
|
||||||
|
*/
|
||||||
|
String API_WX_SET_PREFETCH_DOMAIN = "https://api.weixin.qq.com/wxa/set_prefetchdnsdomain";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取DNS预解析域名
|
||||||
|
*/
|
||||||
|
String API_GET_PREFETCH_DOMAIN = "https://api.weixin.qq.com/wxa/get_prefetchdnsdomain";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得小程序的域名配置信息
|
* 获得小程序的域名配置信息
|
||||||
*
|
*
|
||||||
@ -715,4 +726,21 @@ public interface WxOpenMaService extends WxMaService {
|
|||||||
*/
|
*/
|
||||||
WxOpenVersioninfoResult getVersionInfo() throws WxErrorException;
|
WxOpenVersioninfoResult getVersionInfo() throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置DNS预解析域名
|
||||||
|
*
|
||||||
|
* @param domain 预解析域名列表
|
||||||
|
* @return {@link WxOpenResult}
|
||||||
|
* @throws WxErrorException the wx error exception
|
||||||
|
*/
|
||||||
|
WxOpenResult setPrefetchDomain(WxMaPrefetchDomain domain) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取DNS预解析域名
|
||||||
|
*
|
||||||
|
* @return {@link WxOpenMaPrefetchDomainResult}
|
||||||
|
* @throws WxErrorException he wx error exception
|
||||||
|
*/
|
||||||
|
WxOpenMaPrefetchDomainResult getPrefetchDomain() throws WxErrorException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import me.chanjar.weixin.open.api.WxOpenComponentService;
|
|||||||
import me.chanjar.weixin.open.api.WxOpenMaBasicService;
|
import me.chanjar.weixin.open.api.WxOpenMaBasicService;
|
||||||
import me.chanjar.weixin.open.api.WxOpenMaPrivacyService;
|
import me.chanjar.weixin.open.api.WxOpenMaPrivacyService;
|
||||||
import me.chanjar.weixin.open.api.WxOpenMaService;
|
import me.chanjar.weixin.open.api.WxOpenMaService;
|
||||||
|
import me.chanjar.weixin.open.bean.ma.WxMaPrefetchDomain;
|
||||||
import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam;
|
import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam;
|
||||||
import me.chanjar.weixin.open.bean.ma.WxMaScheme;
|
import me.chanjar.weixin.open.bean.ma.WxMaScheme;
|
||||||
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
|
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
|
||||||
@ -446,4 +447,16 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
|
|||||||
String response = post(API_GET_VERSION_INFO, GSON.toJson(params));
|
String response = post(API_GET_VERSION_INFO, GSON.toJson(params));
|
||||||
return WxMaGsonBuilder.create().fromJson(response, WxOpenVersioninfoResult.class);
|
return WxMaGsonBuilder.create().fromJson(response, WxOpenVersioninfoResult.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxOpenResult setPrefetchDomain(WxMaPrefetchDomain domain) throws WxErrorException {
|
||||||
|
String response = post(API_WX_SET_PREFETCH_DOMAIN, GSON.toJson(domain));
|
||||||
|
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxOpenMaPrefetchDomainResult getPrefetchDomain() throws WxErrorException {
|
||||||
|
String response = get(API_GET_PREFETCH_DOMAIN, null);
|
||||||
|
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaPrefetchDomainResult.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package me.chanjar.weixin.open.bean.ma;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 清心
|
||||||
|
* create on 2022-10-01 18:07
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WxMaPrefetchDomain implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1593947263587362155L;
|
||||||
|
|
||||||
|
@SerializedName("prefetch_dns_domain")
|
||||||
|
private List<DnsDomain> prefetchDnsDomain;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DnsDomain {
|
||||||
|
private String url;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package me.chanjar.weixin.open.bean.result;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 清心
|
||||||
|
* create on 2022-10-01 18:25
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class WxOpenMaPrefetchDomainResult extends WxOpenResult{
|
||||||
|
|
||||||
|
@SerializedName("prefetch_dns_domain")
|
||||||
|
private List<PreDnsDomain> prefetchDnsDomain;
|
||||||
|
|
||||||
|
@SerializedName("size_limit")
|
||||||
|
private Integer sizeLimit;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class PreDnsDomain {
|
||||||
|
|
||||||
|
@SerializedName("url")
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@SerializedName("status")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user