|
@@ -9,6 +9,8 @@ import com.ruoyi.common.exception.user.ProjectException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
import com.ruoyi.generator.domain.Community.CommunityArticle;
|
|
|
+import com.ruoyi.generator.domain.Community.CommunityUserBlock;
|
|
|
+import com.ruoyi.generator.mapper.community.CommunityUserBlockMapper;
|
|
|
import com.ruoyi.system.domain.CommunityChatMsg;
|
|
|
import com.ruoyi.system.domain.vo.CommunityChatMsgVo;
|
|
|
import com.ruoyi.system.domain.vo.SysUserVo;
|
|
@@ -43,6 +45,9 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
@Resource
|
|
|
private SysUserMapper sysUserMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CommunityUserBlockMapper communityUserBlockMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 获取当前登录用户聊天记录
|
|
|
*/
|
|
@@ -52,6 +57,14 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
List<CommunityChatMsgVo> chatMsgVos = new ArrayList<>();
|
|
|
try {
|
|
|
+ List<CommunityUserBlock> communityUserBlocks = communityUserBlockMapper.selectList(new QueryWrapper<CommunityUserBlock>()
|
|
|
+ .eq("user_id", userId)
|
|
|
+ .eq("peer_id", otherUserId));
|
|
|
+ for (CommunityUserBlock userBlock : communityUserBlocks) {
|
|
|
+ if (userBlock.isBlock()) {
|
|
|
+ return AjaxResult.success("当前用户已经被拉黑");
|
|
|
+ }
|
|
|
+ }
|
|
|
List<CommunityChatMsg> chatMsgList = communityChatMsgService.list(new QueryWrapper<CommunityChatMsg>()
|
|
|
.and(wrapper -> wrapper.eq("sender_id", userId)
|
|
|
.eq("receiver_id", otherUserId)
|
|
@@ -93,7 +106,8 @@ public class CommunityChatMsgController extends BaseController {
|
|
|
chatMsgVos.add(chatMsgVo);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- throw new ProjectException();
|
|
|
+ e.printStackTrace();
|
|
|
+ //throw new ProjectException();
|
|
|
}
|
|
|
|
|
|
|