|
@@ -532,14 +532,13 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
communityUserInfoVo.setCompanionCount(0);
|
|
|
|
|
|
|
|
|
-
|
|
|
String truncatedString = null;
|
|
|
try {
|
|
|
String ip = IpUtils.get();
|
|
|
String address = AddressUtils.getRealAddressByIP(ip);
|
|
|
// 使用空格分割字符串
|
|
|
String[] parts = address.split(" ", 2); // 这里的2表示只分割一次
|
|
|
- truncatedString = parts[0].replace("市","").replace("省","");
|
|
|
+ truncatedString = parts[0].replace("市", "").replace("省", "");
|
|
|
} catch (ExecutionException e) {
|
|
|
throw new RuntimeException(e);
|
|
|
} catch (InterruptedException e) {
|
|
@@ -574,12 +573,22 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
/**
|
|
|
* 根据账户或者用户名称,搜索用户
|
|
|
*
|
|
|
- * @param SearchValue
|
|
|
+ * @param SearchValue 搜索值
|
|
|
* @return 用户
|
|
|
*/
|
|
|
@Override
|
|
|
public List<CommunityUserInfoVo> selectUsersByAccountOrName(String SearchValue) {
|
|
|
- return communityUserInfoMapper.selectUsersByAccountOrName(SearchValue);
|
|
|
+ List<CommunityUserInfoVo> communityUserInfoVos = communityUserInfoMapper.selectUsersByAccountOrName(SearchValue);
|
|
|
+ communityUserInfoVos.forEach(item -> {
|
|
|
+ CommunityUserLike communityUserLike = communityUserLikeMapper.selectOne(new QueryWrapper<CommunityUserLike>()
|
|
|
+ .eq("user_id", SecurityUtils.getUserId())
|
|
|
+ .eq("like_user_id", item.getUserId()));
|
|
|
+
|
|
|
+ if (Objects.nonNull(communityUserLike)) {
|
|
|
+ item.setLike(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return communityUserInfoVos;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -771,7 +780,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<TrendingTop> selectTrendingTopByContent(String content) {
|
|
|
+ public List<TrendingTop> selectTrendingTopByContent(String content) {
|
|
|
return communityArticleMapper.selectTrendingTopByContent(content);
|
|
|
}
|
|
|
|