Skip to content

Commit 809ff15

Browse files
xgao-zbinarywang
authored andcommitted
🆕 【微信开放平台】增加申请开通直播的接口
1 parent bb65189 commit 809ff15

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ public interface WxOpenMaService extends WxMaService {
267267
*/
268268
String API_GET_PREFETCH_DOMAIN = "https://api.weixin.qq.com/wxa/get_prefetchdnsdomain";
269269

270+
/**
271+
* 申请开通直播
272+
*/
273+
String API_WX_APPLY_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/applyliveinfo";
274+
270275
/**
271276
* 获得小程序的域名配置信息
272277
*
@@ -743,4 +748,12 @@ WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, Li
743748
*/
744749
WxOpenMaPrefetchDomainResult getPrefetchDomain() throws WxErrorException;
745750

751+
/**
752+
* 申请开通直播
753+
* 文档地址:<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>
754+
* @return {@link WxOpenMaApplyLiveInfoResult}
755+
* @throws WxErrorException the wx error exception
756+
*/
757+
WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException;
758+
746759
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,4 +459,12 @@ public WxOpenMaPrefetchDomainResult getPrefetchDomain() throws WxErrorException
459459
String response = get(API_GET_PREFETCH_DOMAIN, null);
460460
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaPrefetchDomainResult.class);
461461
}
462+
463+
@Override
464+
public WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException {
465+
JsonObject params = new JsonObject();
466+
params.addProperty("action","apply");
467+
String response = post(API_WX_APPLY_LIVE_INFO, GSON.toJson(params));
468+
return WxMaGsonBuilder.create().fromJson(response,WxOpenMaApplyLiveInfoResult.class);
469+
}
462470
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package me.chanjar.weixin.open.bean.result;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
7+
/**
8+
* @author 清心
9+
* created at 2022-10-04 16:11
10+
*/
11+
@EqualsAndHashCode(callSuper = true)
12+
@Data
13+
public class WxOpenMaApplyLiveInfoResult extends WxOpenResult{
14+
15+
@SerializedName("action")
16+
private String action;
17+
18+
}

0 commit comments

Comments
 (0)