|
@@ -7,6 +7,7 @@ import com.keao.edu.im.http.HttpHelper;
|
|
|
import com.keao.edu.im.pojo.IMApiResultInfo;
|
|
|
import com.keao.edu.im.pojo.IMTokenInfo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -288,6 +289,27 @@ public class IMHelper {
|
|
|
return JSON.parseObject(httpHelper.returnResult(conn, body), IMApiResultInfo.class);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询房间状态
|
|
|
+ * @param roomId
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public IMApiResultInfo roomQuery(String roomId) throws Exception {
|
|
|
+ if (StringUtils.isEmpty(roomId)) {
|
|
|
+ throw new IllegalArgumentException("Paramer 'roomId' is required");
|
|
|
+ }
|
|
|
+
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("roomId=").append(URLEncoder.encode(roomId, UTF8));
|
|
|
+ String body = sb.toString();
|
|
|
+
|
|
|
+ HttpURLConnection conn = httpHelper.createIMRtcPostHttpConnection("/rtc/room/query", "application/x-www-form-urlencoded",null);
|
|
|
+ httpHelper.setBodyParameter(body, conn);
|
|
|
+ String returnResult = httpHelper.returnResult(conn, body);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 发送群组消息方法(以一个用户身份向群组发送消息,单条消息最大 128k.每秒钟最多发送 20 条消息,每次最多向 3 个群组发送,如:一次向 3 个群组发送消息,示为 3 条消息。)
|
|
@@ -360,11 +382,11 @@ public class IMHelper {
|
|
|
sb.append("&content=").append(URLEncoder.encode(msgStr, UTF8));
|
|
|
|
|
|
if (pushContent != null) {
|
|
|
- sb.append("&pushContent=").append(URLEncoder.encode(pushContent.toString(), UTF8));
|
|
|
+ sb.append("&pushContent=").append(URLEncoder.encode(pushContent, UTF8));
|
|
|
}
|
|
|
|
|
|
if (pushData != null) {
|
|
|
- sb.append("&pushData=").append(URLEncoder.encode(pushData.toString(), UTF8));
|
|
|
+ sb.append("&pushData=").append(URLEncoder.encode(pushData, UTF8));
|
|
|
}
|
|
|
|
|
|
if (isPersisted != null) {
|