🆕 【微信开放平台】增加申请开通直播的接口

This commit is contained in:
清心 2022-10-13 07:28:02 +00:00 committed by binarywang
parent bb65189fb8
commit 809ff15709
3 changed files with 39 additions and 0 deletions

View File

@ -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;
/**
* 申请开通直播
* 文档地址<a href="https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/live-player/applyLivelnfo.html">https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/live-player/applyLivelnfo.html</a>
* @return {@link WxOpenMaApplyLiveInfoResult}
* @throws WxErrorException the wx error exception
*/
WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException;
}

View File

@ -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);
}
}

View File

@ -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;
}