This commit is contained in:
abu 2025-04-23 16:24:59 +08:00
parent 8ded07048f
commit d165490661
5 changed files with 16 additions and 1 deletions

View File

@ -135,7 +135,7 @@ public class UserInfoController extends BaseInfoProperties {
@ApiOperation(value = "根据昵称搜索用户") @ApiOperation(value = "根据昵称搜索用户")
@GetMapping("searchByNickname") @GetMapping("searchByNickname")
public GraceJSONResult searchByNickname(@RequestParam String nickname, public GraceJSONResult searchByNickname(@RequestParam String nickname,
@RequestParam String id, @RequestParam(defaultValue = "") String id,
@RequestParam Integer page, @RequestParam Integer page,
@RequestParam Integer pageSize){ @RequestParam Integer pageSize){
try { try {

View File

@ -295,6 +295,9 @@ public class UserServiceImpl implements UserService {
try { try {
PageHelper.startPage(page, pageSize); PageHelper.startPage(page, pageSize);
List<UsersVO> userList = usersMapper.searchByNickname(nickname); List<UsersVO> userList = usersMapper.searchByNickname(nickname);
if(currentUserId.isEmpty()){
return userList;
}
// 提取模糊查询出的用户 ID 列表 // 提取模糊查询出的用户 ID 列表
List<String> vlogerIds = userList.stream().map(UsersVO::getId).collect(Collectors.toList()); List<String> vlogerIds = userList.stream().map(UsersVO::getId).collect(Collectors.toList());

View File

@ -134,6 +134,8 @@ public class VlogServiceImpl extends BaseInfoProperties implements VlogService {
// 获得当前视频被点赞过的总数 // 获得当前视频被点赞过的总数
v.setLikeCounts(getVlogBeLikedCounts(vlogId)); v.setLikeCounts(getVlogBeLikedCounts(vlogId));
// 评论数
v.setCommentsCounts(getVlogComment(vlogId));
} }
// return list; // return list;
@ -167,6 +169,16 @@ public class VlogServiceImpl extends BaseInfoProperties implements VlogService {
} }
return Integer.valueOf(countsStr); return Integer.valueOf(countsStr);
} }
private Integer getVlogComment(String vlogId) {
String countsStr = redis.get(REDIS_VLOG_COMMENT_COUNTS + ":" + vlogId);
if (StringUtils.isBlank(countsStr)) {
countsStr = "0";
}
return Integer.valueOf(countsStr);
}
// //
private boolean doILikeVlog(String myId, String vlogId) { private boolean doILikeVlog(String myId, String vlogId) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.