【应急单】定时解散群聊
This commit is contained in:
@@ -12,6 +12,7 @@ import com.renkang.im.util.IdWorker;
|
||||
import com.renkang.im.util.TencentCloudImUtil;
|
||||
import com.renkang.im.util.UniqId;
|
||||
import com.renkang.im.vo.AddGroupMemberVO;
|
||||
import com.renkang.im.vo.ImBaseResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@@ -397,6 +398,12 @@ public class TXController {
|
||||
return Result.OK(tencentCloudImUtil.addGroupMember(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "解散群组", description = "解散群组")
|
||||
@GetMapping("/destroyGroup")
|
||||
public Result<ImBaseResult> destroyGroup(@RequestParam("groupId") String groupId) {
|
||||
return Result.OK(tencentCloudImUtil.destroyGroup(groupId));
|
||||
}
|
||||
|
||||
private String encodeChineseCharacters(String str) {
|
||||
return str.codePoints()
|
||||
.mapToObj(c -> {
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.renkang.im.common.TencentCloudImConstant;
|
||||
import com.renkang.im.dto.AddGroupMemberDTO;
|
||||
import com.renkang.im.entity.*;
|
||||
import com.renkang.im.vo.AddGroupMemberVO;
|
||||
import com.renkang.im.vo.ImBaseResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -479,6 +480,30 @@ public class TencentCloudImUtil {
|
||||
return addGroupMemberVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解散群组
|
||||
*
|
||||
* @param groupId
|
||||
* @return
|
||||
*/
|
||||
public ImBaseResult destroyGroup(String groupId) {
|
||||
try {
|
||||
Integer random = RandomUtils.nextInt(0, 999999999);
|
||||
String httpsUrl = getHttpsUrl(TencentCloudImApiConstant.GroupManage.DESTROY_GROUP, random);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("GroupId", groupId);
|
||||
log.info("腾讯云im【解散群组】,请求参数:{}", jsonObject);
|
||||
String result = HttpUtil.doPost(httpsUrl, jsonObject);
|
||||
log.info("腾讯云im【解散群组】,返回结果:{}", result);
|
||||
return JSONObject.toJavaObject(JSONObject.parseObject(result), ImBaseResult.class);
|
||||
} catch (Exception e) {
|
||||
log.error("【解散群组】异常:{}", e.getMessage());
|
||||
ImBaseResult result = new ImBaseResult();
|
||||
result.setActionStatus("FAIL");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 拉取群聊历史消息
|
||||
|
||||
Reference in New Issue
Block a user