From 13356d1cd535b56158f9ba0686a8797df9f7b28e Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Tue, 16 Feb 2021 00:12:35 +0800 Subject: [PATCH] =?UTF-8?q?:new:=20#1895=20=E3=80=90=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E3=80=91=E7=9B=B4=E6=92=AD=E5=A2=9E=E5=8A=A0=E6=88=90?= =?UTF-8?q?=E5=91=98=E7=AE=A1=E7=90=86=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wx/miniapp/api/WxMaLiveMemberService.java | 55 +++++++++++++++++ .../wx/miniapp/api/WxMaService.java | 7 +++ .../miniapp/api/impl/BaseWxMaServiceImpl.java | 6 ++ .../api/impl/WxMaLiveGoodsServiceImpl.java | 23 +++---- .../api/impl/WxMaLiveMemberServiceImpl.java | 42 +++++++++++++ .../miniapp/api/impl/WxMaLiveServiceImpl.java | 22 +++---- .../miniapp/constant/WxMaApiUrlConstants.java | 60 ++++++++++++------- .../impl/WxMaLiveMemberServiceImplTest.java | 40 +++++++++++++ 8 files changed, 209 insertions(+), 46 deletions(-) create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveMemberService.java create mode 100644 weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImpl.java create mode 100644 weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImplTest.java diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveMemberService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveMemberService.java new file mode 100644 index 000000000..02e20923b --- /dev/null +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveMemberService.java @@ -0,0 +1,55 @@ +package cn.binarywang.wx.miniapp.api; + +import com.google.gson.JsonArray; +import me.chanjar.weixin.common.error.WxErrorException; + + +/** + * 【小程序直播】成员管理接口. + * https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/role-manage.html + * + * @author Binary Wang + * @date 2021 -02-15 + */ +public interface WxMaLiveMemberService { + /** + * 1.设置成员角色 + * 调用此接口设置小程序直播成员的管理员、运营者和主播角色 + * 调用额度:10000次/一天 + * 请求URL : https://api.weixin.qq.com/wxaapi/broadcast/role/addrole?access_token= + * + * @param username 用户的微信号 + * @param role 设置用户的角色,取值[1-管理员,2-主播,3-运营者],设置超级管理员将无效 + * @return the string + * @throws WxErrorException the wx error exception + */ + String addRole(String username, int role) throws WxErrorException; + + /** + * 2.解除成员角色 + * 调用此接口移除小程序直播成员的管理员、运营者和主播角色 + * 调用额度:10000次/一天 + * 请求URL:https://api.weixin.qq.com/wxaapi/broadcast/role/deleterole?access_token= + * + * @param username 用户的微信号 + * @param role 设置用户的角色,取值[1-管理员,2-主播,3-运营者],设置超级管理员将无效 + * @return the string + * @throws WxErrorException the wx error exception + */ + String deleteRole(String username, int role) throws WxErrorException; + + /** + * 3.查询成员列表 + * 调用此接口查询小程序直播成员列表 + * 调用额度:10000次/一天 + * 请求URL:https://api.weixin.qq.com/wxaapi/broadcast/role/getrolelist?access_token= + * + * @param role 查询的用户角色,取值 [-1-所有成员, 0-超级管理员,1-管理员,2-主播,3-运营者],默认-1 + * @param offset 起始偏移量, 默认0 + * @param limit 查询个数,最大30,默认10 + * @param keyword 搜索的微信号或昵称,不传则返回全部 + * @return . json array + * @throws WxErrorException the wx error exception + */ + JsonArray listByRole(Integer role, Integer offset, Integer limit, String keyword) throws WxErrorException; +} diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java index c1bdb2697..bdbb47268 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaService.java @@ -356,6 +356,13 @@ public interface WxMaService extends WxService { */ WxMaLiveGoodsService getLiveGoodsService(); + /** + * 获取直播成员管理接口服务对象 + * + * @return . live service + */ + WxMaLiveMemberService getLiveMemberService(); + /** * 获取ocr实现接口服务对象 * diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java index fe59e1e43..ebbcbfc69 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/BaseWxMaServiceImpl.java @@ -60,6 +60,7 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH private final WxMaCloudService cloudService = new WxMaCloudServiceImpl(this); private final WxMaLiveService liveService = new WxMaLiveServiceImpl(this); private final WxMaLiveGoodsService liveGoodsService = new WxMaLiveGoodsServiceImpl(this); + private final WxMaLiveMemberService liveMemberService = new WxMaLiveMemberServiceImpl(this); private final WxOcrService ocrService = new WxMaOcrServiceImpl(this); private final WxImgProcService imgProcService = new WxMaImgProcServiceImpl(this); private Map configMap; @@ -483,6 +484,11 @@ public abstract class BaseWxMaServiceImpl implements WxMaService, RequestH return this.liveGoodsService; } + @Override + public WxMaLiveMemberService getLiveMemberService() { + return this.liveMemberService; + } + @Override public WxOcrService getOcrService() { return this.ocrService; diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveGoodsServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveGoodsServiceImpl.java index da2fff572..99d82fdbf 100644 --- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveGoodsServiceImpl.java +++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveGoodsServiceImpl.java @@ -11,6 +11,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import lombok.RequiredArgsConstructor; import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.common.util.json.GsonHelper; import me.chanjar.weixin.common.util.json.GsonParser; import java.io.Serializable; @@ -18,7 +19,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.LiveGoods.*; +import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.Goods.*; /** *
@@ -34,32 +35,26 @@ public class WxMaLiveGoodsServiceImpl implements WxMaLiveGoodsService {
   @Override
   public WxMaLiveResult addGoods(WxMaLiveGoodInfo goods) throws WxErrorException {
     return WxMaLiveResult.fromJson(this.wxMaService.post(ADD_GOODS,
-      WxMaGsonBuilder.create().toJson(ImmutableMap.of("goodsInfo", goods))));
+      GsonHelper.buildJsonObject("goodsInfo", goods)));
   }
 
   @Override
   public boolean resetAudit(Integer auditId, Integer goodsId) throws WxErrorException {
-    Map map = new HashMap<>(4);
-    map.put("auditId", auditId);
-    map.put("goodsId", goodsId);
-    this.wxMaService.post(RESET_AUDIT_GOODS, WxMaGsonBuilder.create().toJson(map));
+    this.wxMaService.post(RESET_AUDIT_GOODS,
+      GsonHelper.buildJsonObject("auditId", auditId, "goodsId", goodsId));
     return true;
   }
 
   @Override
   public String auditGoods(Integer goodsId) throws WxErrorException {
-    Map map = new HashMap<>(2);
-    map.put("goodsId", goodsId);
-    String responseContent = this.wxMaService.post(AUDIT_GOODS, WxMaGsonBuilder.create().toJson(map));
-    JsonObject jsonObject = GsonParser.parse(responseContent);
-    return jsonObject.get("auditId").getAsString();
+    String responseContent = this.wxMaService.post(AUDIT_GOODS,
+      GsonHelper.buildJsonObject("goodsId", goodsId));
+    return GsonParser.parse(responseContent).get("auditId").getAsString();
   }
 
   @Override
   public boolean deleteGoods(Integer goodsId) throws WxErrorException {
-    Map map = new HashMap<>(2);
-    map.put("goodsId", goodsId);
-    this.wxMaService.post(DELETE_GOODS, WxMaGsonBuilder.create().toJson(map));
+    this.wxMaService.post(DELETE_GOODS, GsonHelper.buildJsonObject("goodsId", goodsId));
     return true;
   }
 
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImpl.java
new file mode 100644
index 000000000..568630466
--- /dev/null
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImpl.java
@@ -0,0 +1,42 @@
+package cn.binarywang.wx.miniapp.api.impl;
+
+import cn.binarywang.wx.miniapp.api.WxMaLiveMemberService;
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.Role;
+import com.google.gson.JsonArray;
+import lombok.RequiredArgsConstructor;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.util.json.GsonHelper;
+import me.chanjar.weixin.common.util.json.GsonParser;
+
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.Role.LIST_BY_ROLE;
+
+/**
+ * .
+ *
+ * @author Binary Wang
+ * @date 2021-02-15
+ */
+@RequiredArgsConstructor
+public class WxMaLiveMemberServiceImpl implements WxMaLiveMemberService {
+  private final WxMaService service;
+
+  @Override
+  public String addRole(String username, int role) throws WxErrorException {
+    return this.service.post(Role.ADD_ROLE,
+      GsonHelper.buildJsonObject("username", username, "role", role));
+  }
+
+  @Override
+  public String deleteRole(String username, int role) throws WxErrorException {
+    return this.service.post(Role.DELETE_ROLE,
+      GsonHelper.buildJsonObject("username", username, "role", role));
+  }
+
+  @Override
+  public JsonArray listByRole(Integer role, Integer offset, Integer limit, String keyword) throws WxErrorException {
+    final String response = this.service.get(LIST_BY_ROLE, GsonHelper.buildJsonObject("role", role, "offset", offset,
+      "limit", limit, "keyword", keyword).toString());
+    return GsonParser.parse(response).getAsJsonArray("list");
+  }
+}
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveServiceImpl.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveServiceImpl.java
index 9040957c7..9e192eb48 100644
--- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveServiceImpl.java
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveServiceImpl.java
@@ -18,7 +18,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Live.*;
+import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Broadcast.*;
 
 /**
  * 
@@ -36,7 +36,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
 
   @Override
   public WxMaCreateRoomResult createRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException {
-    String responseContent = this.wxMaService.post(CREATE_ROOM, WxMaGsonBuilder.create().toJson(roomInfo));
+    String responseContent = this.wxMaService.post(Room.CREATE_ROOM, WxMaGsonBuilder.create().toJson(roomInfo));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -49,7 +49,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
   public boolean deleteRoom(Integer roomId) throws WxErrorException {
     Map map = new HashMap<>(2);
     map.put("id", roomId);
-    String responseContent = this.wxMaService.post(DELETE_ROOM, WxMaGsonBuilder.create().toJson(map));
+    String responseContent = this.wxMaService.post(Room.DELETE_ROOM, WxMaGsonBuilder.create().toJson(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -59,7 +59,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
 
   @Override
   public boolean editRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException {
-    String responseContent = this.wxMaService.post(EDIT_ROOM, WxMaGsonBuilder.create().toJson(roomInfo));
+    String responseContent = this.wxMaService.post(Room.EDIT_ROOM, WxMaGsonBuilder.create().toJson(roomInfo));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -71,7 +71,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
   public String getPushUrl(Integer roomId) throws WxErrorException {
     Map map = new HashMap<>(2);
     map.put(ROOM_ID, roomId);
-    String responseContent = this.wxMaService.get(GET_PUSH_URL, Joiner.on("&").withKeyValueSeparator("=").join(map));
+    String responseContent = this.wxMaService.get(Room.GET_PUSH_URL, Joiner.on("&").withKeyValueSeparator("=").join(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -86,7 +86,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
     if (null != params) {
       map.put("params", params);
     }
-    String responseContent = this.wxMaService.get(GET_SHARED_CODE, Joiner.on("&").withKeyValueSeparator("=").join(map));
+    String responseContent = this.wxMaService.get(Room.GET_SHARED_CODE, Joiner.on("&").withKeyValueSeparator("=").join(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -162,7 +162,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
     Map map = new HashMap<>(2);
     map.put(ROOM_ID, roomId);
     map.put("ids", goodsIds);
-    String responseContent = this.wxMaService.post(ADD_GOODS, WxMaGsonBuilder.create().toJson(map));
+    String responseContent = this.wxMaService.post(Room.ADD_GOODS, WxMaGsonBuilder.create().toJson(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -175,7 +175,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
     Map map = new HashMap<>(2);
     map.put(ROOM_ID, roomId);
     map.put("users", users);
-    String responseContent = this.wxMaService.post(ADD_ASSISTANT, WxMaGsonBuilder.create().toJson(map));
+    String responseContent = this.wxMaService.post(Room.ADD_ASSISTANT, WxMaGsonBuilder.create().toJson(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -189,7 +189,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
     map.put(ROOM_ID, roomId);
     map.put("username", username);
     map.put("nickname", nickname);
-    String responseContent = this.wxMaService.post(MODIFY_ASSISTANT, WxMaGsonBuilder.create().toJson(map));
+    String responseContent = this.wxMaService.post(Room.MODIFY_ASSISTANT, WxMaGsonBuilder.create().toJson(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -202,7 +202,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
     Map map = new HashMap<>(2);
     map.put(ROOM_ID, roomId);
     map.put("username", username);
-    String responseContent = this.wxMaService.post(REMOVE_ASSISTANT, WxMaGsonBuilder.create().toJson(map));
+    String responseContent = this.wxMaService.post(Room.REMOVE_ASSISTANT, WxMaGsonBuilder.create().toJson(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
@@ -214,7 +214,7 @@ public class WxMaLiveServiceImpl implements WxMaLiveService {
   public List getAssistantList(Integer roomId) throws WxErrorException {
     Map map = new HashMap<>(2);
     map.put(ROOM_ID, roomId);
-    String responseContent = this.wxMaService.post(GET_ASSISTANT_LIST, WxMaGsonBuilder.create().toJson(map));
+    String responseContent = this.wxMaService.post(Room.GET_ASSISTANT_LIST, WxMaGsonBuilder.create().toJson(map));
     JsonObject jsonObject = GsonParser.parse(responseContent);
     if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
       throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
diff --git a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
index 49f6a18db..84b1f806d 100644
--- a/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
+++ b/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
@@ -157,28 +157,46 @@ public class WxMaApiUrlConstants {
     String GET_JSAPI_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket";
   }
 
-  public interface LiveGoods {
-    String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add";
-    String RESET_AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit";
-    String AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/audit";
-    String DELETE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete";
-    String UPDATE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/update";
-    String GET_GOODS_WARE_HOUSE = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse";
-    String GET_APPROVED_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getapproved";
-  }
-
-  public interface Live {
+  public interface Broadcast {
     String GET_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/getliveinfo";
-    String CREATE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/create";
-    String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods";
-    String DELETE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom";
-    String EDIT_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom";
-    String GET_PUSH_URL = "https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl";
-    String GET_SHARED_CODE = "https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode";
-    String ADD_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant";
-    String MODIFY_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant";
-    String REMOVE_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant";
-    String GET_ASSISTANT_LIST = "https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist";
+
+    /**
+     * 直播间管理相关接口
+     */
+    interface Room {
+      String CREATE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/create";
+      String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods";
+      String DELETE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom";
+      String EDIT_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom";
+      String GET_PUSH_URL = "https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl";
+      String GET_SHARED_CODE = "https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode";
+      String ADD_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant";
+      String MODIFY_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant";
+      String REMOVE_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant";
+      String GET_ASSISTANT_LIST = "https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist";
+    }
+
+    /**
+     * 直播商品管理相关接口
+     */
+    interface Goods {
+      String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add";
+      String RESET_AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit";
+      String AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/audit";
+      String DELETE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete";
+      String UPDATE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/update";
+      String GET_GOODS_WARE_HOUSE = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse";
+      String GET_APPROVED_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getapproved";
+    }
+
+    /**
+     * 小程序直播成员管理接口
+     */
+    interface Role {
+      String ADD_ROLE = "https://api.weixin.qq.com/wxaapi/broadcast/role/addrole";
+      String DELETE_ROLE = "https://api.weixin.qq.com/wxaapi/broadcast/role/deleterole";
+      String LIST_BY_ROLE = "https://api.weixin.qq.com/wxaapi/broadcast/role/getrolelist";
+    }
   }
 
   public interface Media {
diff --git a/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImplTest.java b/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImplTest.java
new file mode 100644
index 000000000..f5ffb59d7
--- /dev/null
+++ b/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImplTest.java
@@ -0,0 +1,40 @@
+package cn.binarywang.wx.miniapp.api.impl;
+
+import cn.binarywang.wx.miniapp.api.WxMaService;
+import cn.binarywang.wx.miniapp.test.ApiTestModule;
+import com.google.gson.JsonArray;
+import com.google.inject.Inject;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+/**
+ * 测试.
+ *
+ * @author Binary Wang
+ * @date 2021-02-15
+ */
+@Test
+@Guice(modules = ApiTestModule.class)
+public class WxMaLiveMemberServiceImplTest {
+  @Inject
+  private WxMaService wxService;
+
+  @Test
+  public void testAddRole() throws WxErrorException {
+    final String result = this.wxService.getLiveMemberService().addRole("abc", 1);
+    System.out.println(result);
+  }
+
+  @Test
+  public void testDeleteRole() throws WxErrorException {
+    final String result = this.wxService.getLiveMemberService().deleteRole("abc", 1);
+    System.out.println(result);
+  }
+
+  @Test
+  public void testListByRole() throws WxErrorException {
+    final JsonArray result = this.wxService.getLiveMemberService().listByRole(null, null, null, null);
+    System.out.println(result);
+  }
+}