|
@@ -490,4 +490,40 @@ public class IMHelper {
|
|
|
return (IMUserOnlineInfo) GsonUtil.fromJson(httpHelper.returnResult(conn), IMUserOnlineInfo.class);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加禁言成员
|
|
|
+ *
|
|
|
+ * @param userId 用户 ID,可同时禁言多个用户,最多不超过 20 个。
|
|
|
+ * @param roomUid 聊天室 ID。
|
|
|
+ * @param minute 禁言时长,以分钟为单位,最大值为 43200 分钟。
|
|
|
+ */
|
|
|
+ public IMApiResultInfo addUserUnableSpeak(String roomUid, String userId, String minute) throws Exception {
|
|
|
+ String body = "&userId=" + URLEncoder.encode(userId, UTF8) +
|
|
|
+ "&chatroomId=" + URLEncoder.encode(roomUid, UTF8) +
|
|
|
+ "&minute=" + URLEncoder.encode(minute, UTF8);
|
|
|
+ if (body.indexOf("&") == 0) {
|
|
|
+ body = body.substring(1);
|
|
|
+ }
|
|
|
+ HttpURLConnection conn = httpHelper.createIMPostHttpConnection("/chatroom/user/gag/add.json", "application/x-www-form-urlencoded");
|
|
|
+ httpHelper.setBodyParameter(body, conn);
|
|
|
+ return (IMApiResultInfo) GsonUtil.fromJson(httpHelper.returnResult(conn), IMApiResultInfo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移除禁言成员
|
|
|
+ *
|
|
|
+ * @param userId 用户 ID
|
|
|
+ * @param roomUid 聊天室 ID。
|
|
|
+ */
|
|
|
+ public IMApiResultInfo removeUserUnableSpeak(String roomUid, String userId) throws Exception {
|
|
|
+ String body = "&userId=" + URLEncoder.encode(userId, UTF8) +
|
|
|
+ "&chatroomId=" + URLEncoder.encode(roomUid, UTF8);
|
|
|
+ if (body.indexOf("&") == 0) {
|
|
|
+ body = body.substring(1);
|
|
|
+ }
|
|
|
+ HttpURLConnection conn = httpHelper.createIMPostHttpConnection("/chatroom/user/gag/rollback.json", "application/x-www-form-urlencoded");
|
|
|
+ httpHelper.setBodyParameter(body, conn);
|
|
|
+ return (IMApiResultInfo) GsonUtil.fromJson(httpHelper.returnResult(conn), IMApiResultInfo.class);
|
|
|
+ }
|
|
|
+
|
|
|
}
|