fix(service): 修复查询用户主题时调用错误服务

将 KeyboardThemePurchaseService 改为 userThemesService,并调整查询条件从支付状态改为删除标记,确保获取正确的用户主题列表。
This commit is contained in:
2025-12-22 16:39:01 +08:00
parent 44f031c939
commit ecce22384b

View File

@@ -205,14 +205,14 @@ public class KeyboardThemePurchaseServiceImpl extends ServiceImpl<KeyboardThemeP
* @return 用户已购买的主题详情列表
*/
public List<KeyboardThemesRespVO> getUserPurchasedThemes(Long userId) {
// 1. 查询用户所有已支付的主题ID列表
List<Long> themeIds = this.lambdaQuery()
.eq(KeyboardThemePurchase::getUserId, userId) // 根据用户ID筛选
.eq(KeyboardThemePurchase::getPayStatus, (short) 1) // 支付状态为1已支付
// 1. 从用户主题表查询主题ID列表
List<Long> themeIds = userThemesService.lambdaQuery()
.eq(KeyboardUserThemes::getUserId, userId)
.eq(KeyboardUserThemes::getViewDeleted, false)
.list()
.stream()
.map(KeyboardThemePurchase::getThemeId) // 提取主题ID
.distinct() // 去重
.map(KeyboardUserThemes::getThemeId)
.distinct()
.collect(java.util.stream.Collectors.toList());
// 2. 如果没有购买记录,返回空列表