Commit f850d119 by giaogiao

灵活配置该应用 是否允许重复创建会话

parent 8ff4dadd
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.wecloud.im.entity.ImApplication;
import com.wecloud.im.entity.ImClient;
import com.wecloud.im.entity.ImConversation;
import com.wecloud.im.entity.ImConversationMembers;
......@@ -28,6 +29,8 @@ import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import io.geekidea.springbootplus.framework.shiro.util.JwtUtil;
import io.geekidea.springbootplus.framework.shiro.util.SnowflakeUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -91,6 +94,16 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
}
}
// shiro线程中获取当前token
JwtToken curentJwtToken = JwtUtil.getCurentJwtToken();
// 根据appKey查询appid
ImApplication imApplication = imApplicationService.getOne(
new QueryWrapper<ImApplication>().lambda()
.eq(ImApplication::getAppKey, curentJwtToken.getAppKey())
);
// 该应用 是否允许重复创建会话
if (imApplication.getRepeatSessionStatus() == 0) {
// 判断是否已经存在会话
// 两个用户如果已经创建过会话,不能重复创建会话
// size() == 1 为单聊的时候不允许重复创建
......@@ -112,6 +125,7 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
return ApiResult.ok(imConversationCreateVo);
}
}
}
// 会话id
Long imConversationId = SnowflakeUtil.getId();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment