From 809ff15709bc71bd3cf248f32a3496e3b68bb014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=85=E5=BF=83?= <3046836433@qq.com> Date: Thu, 13 Oct 2022 07:28:02 +0000 Subject: [PATCH] =?UTF-8?q?:new:=20=E3=80=90=E5=BE=AE=E4=BF=A1=E5=BC=80?= =?UTF-8?q?=E6=94=BE=E5=B9=B3=E5=8F=B0=E3=80=91=E5=A2=9E=E5=8A=A0=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=BC=80=E9=80=9A=E7=9B=B4=E6=92=AD=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../weixin/open/api/WxOpenMaService.java | 13 +++++++++++++ .../open/api/impl/WxOpenMaServiceImpl.java | 8 ++++++++ .../result/WxOpenMaApplyLiveInfoResult.java | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaApplyLiveInfoResult.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 9f13ee6d8..f2b1c6277 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 @@ -267,6 +267,11 @@ public interface WxOpenMaService extends WxMaService { */ String API_GET_PREFETCH_DOMAIN = "https://api.weixin.qq.com/wxa/get_prefetchdnsdomain"; + /** + * 申请开通直播 + */ + String API_WX_APPLY_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/applyliveinfo"; + /** * 获得小程序的域名配置信息 * @@ -743,4 +748,12 @@ public interface WxOpenMaService extends WxMaService { */ WxOpenMaPrefetchDomainResult getPrefetchDomain() throws WxErrorException; + /** + * 申请开通直播 + * 文档地址:https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/live-player/applyLivelnfo.html + * @return {@link WxOpenMaApplyLiveInfoResult} + * @throws WxErrorException the wx error exception + */ + WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException; + } 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 67dab4aa5..a226b4157 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 @@ -459,4 +459,12 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ String response = get(API_GET_PREFETCH_DOMAIN, null); return WxMaGsonBuilder.create().fromJson(response, WxOpenMaPrefetchDomainResult.class); } + + @Override + public WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("action","apply"); + String response = post(API_WX_APPLY_LIVE_INFO, GSON.toJson(params)); + return WxMaGsonBuilder.create().fromJson(response,WxOpenMaApplyLiveInfoResult.class); + } } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaApplyLiveInfoResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaApplyLiveInfoResult.java new file mode 100644 index 000000000..d65e19b85 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaApplyLiveInfoResult.java @@ -0,0 +1,18 @@ +package me.chanjar.weixin.open.bean.result; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * @author 清心 + * created at 2022-10-04 16:11 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class WxOpenMaApplyLiveInfoResult extends WxOpenResult{ + + @SerializedName("action") + private String action; + +}