Ver Fonte

fix(rating): 修复好评送券活动参与次数限制逻辑

- 添加优惠券数量检查条件到参与次数限制判断
- 修改参与次数比较逻辑以同时考虑活动限制和优惠券数量
- 确保只有在优惠券充足时才执行参与次数限制检查
fcw há 2 semanas atrás
pai
commit
325d7fa0c5

+ 3 - 2
alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java

@@ -494,11 +494,12 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                         
                         // 检查参与次数限制(每个活动单独计算)
                         Integer limit = activity.getParticipationLimit();
-                        if (limit != null && limit > 0) {
+                        Integer couponQuantity = activity.getCouponQuantity();
+                        if (limit != null && limit > 0 && couponQuantity != null && couponQuantity > 0) {
                             // 审核成功之前的评论不计算在参与次数中(只统计审核成功时间在活动审核时间之后的评论)
                             int passedCount = commonRatingMapper.countPassedGoodRatingsByUserAndStore(
                                     commonRating.getUserId(), businessId, activity.getAuditTime());
-                            if (passedCount > limit) {
+                            if (passedCount > limit && passedCount > couponQuantity) {
                                 log.info("CommonRatingService 好评送券跳过:超过运营活动参与次数 activityId={}, participation_limit={}, count={}, userId={}, storeId={}, activityStartTime={}",
                                         activity.getId(), limit, passedCount, commonRating.getUserId(), businessId, activity.getStartTime());
                                 continue; // 跳过该活动,继续处理下一个