ranking 接口增加默认用户信息返回

This commit is contained in:
tianfeng 2025-10-13 10:09:02 +08:00
parent e9be8b307a
commit 403c88e181

View File

@ -9,6 +9,8 @@ import com.red.circle.other.app.command.activity.RechargeLeaderboardQryExe;
import com.red.circle.other.app.command.activity.RoomGiftsLeaderboardQryExe;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardListCO;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.infra.database.cache.key.RankKey;
import com.red.circle.other.infra.database.cache.service.user.RankCacheService;
import lombok.RequiredArgsConstructor;
@ -33,6 +35,7 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
private final GiftsSendLeaderboardQryExe giftsSendLeaderboardQryExe;
private final GiftsReceivedLeaderboardQryExe giftsReceivedLeaderboardQryExe;
private final RankCacheService rankCacheService;
private final UserProfileGateway userProfileGateway;
@Override
public ActivityLeaderboardCO roomGiftsLeaderboard(AppExtCommand cmd) {
@ -186,7 +189,7 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
@Override
public ActivityLeaderboardCO.LeaderboardUserCO myRank(AppExtCommand cmd, String type, String dateType) {
if (Objects.isNull(type) || Objects.isNull(dateType)) {
return null;
return defaultRankInfo(cmd.getReqUserId());
}
ActivityLeaderboardCO leaderboard;
@ -201,7 +204,7 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
leaderboard = giftsReceivedLeaderboard(cmd);
break;
default:
return null;
return defaultRankInfo(cmd.getReqUserId());
}
Long userId = cmd.getReqUserId();
@ -221,11 +224,11 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
rankList = leaderboard.getMonthly();
break;
default:
return null;
return defaultRankInfo(cmd.getReqUserId());
}
if (Objects.isNull(rankList) || rankList.isEmpty()) {
return null;
return defaultRankInfo(cmd.getReqUserId());
}
// 查找用户排名
@ -237,6 +240,16 @@ public class ActivityLeaderboardServiceImpl implements ActivityLeaderboardServic
}
}
return null;
return defaultRankInfo(cmd.getReqUserId());
}
private ActivityLeaderboardCO.LeaderboardUserCO defaultRankInfo(Long userId) {
UserProfile userProfile = userProfileGateway.getByUserId(userId);
return new ActivityLeaderboardCO.LeaderboardUserCO()
.setId(userProfile.getId())
.setAvatar(userProfile.getUserAvatar())
.setNickname(userProfile.getUserNickname())
.setQuantity(0L)
.setQuantityFormat("0");
}
}