liuchengsen 1 miesiąc temu
rodzic
commit
baa2ddfdff

+ 1 - 1
zhijiayun-activity/src/main/java/com/xuekairui/activity/entity/ActivityCheckinCycleConfig.java

@@ -27,7 +27,7 @@ public class ActivityCheckinCycleConfig {
     private LocalDateTime startTime;
     private LocalDateTime endTime;
 
-    /** 周期模式:FRI_THU */
+    /** 周期模式:FRI_THU(周五至周四)/ MON_SUN(周一至周日) */
     @Builder.Default
     private String cycleMode = "FRI_THU";
 

+ 24 - 0
zhijiayun-activity/src/main/java/com/xuekairui/activity/service/ActivityInviteService.java

@@ -104,9 +104,21 @@ public class ActivityInviteService implements ActivityInviteGate {
      * <p>
      * 场景:被邀请人已通过入驻审核,后补填邀请码 → 邀请人应获得奖励。
      * 活动未开启则不发放。幂等由 uk_invitee 唯一索引保障。
+     * <p>
+     * 重要:必须验证入驻状态为 APPROVED,避免仅因高级会员身份而误发奖励。
      */
     @Override
     public void grantRewardForApprovedUser(Long inviterId, Long inviteeId) {
+        // 验证入驻状态:必须是 APPROVED 才发放奖励
+        Long approvedCount = businessLicenseMapper.selectCount(
+                new LambdaQueryWrapper<BusinessLicense>()
+                        .eq(BusinessLicense::getUserId, inviteeId)
+                        .eq(BusinessLicense::getReviewStatus, LicenseStatus.APPROVED.name()));
+        if (approvedCount == null || approvedCount == 0) {
+            log.warn("被邀请人入驻状态非APPROVED,跳过补填发奖: inviteeId={}", inviteeId);
+            return;
+        }
+
         ActivityInviteConfig config = getConfig();
         if (!isActive(config)) {
             log.info("邀请有礼活动未开启,跳过已入驻补填发奖: inviter={}, invitee={}", inviterId, inviteeId);
@@ -238,6 +250,8 @@ public class ActivityInviteService implements ActivityInviteGate {
      * 入驻审核通过后发放邀请人奖励(依赖活动配置,不再区分触发模式)。
      * <p>
      * 活动未开启则不发放。幂等由 uk_invitee 唯一索引保障。
+     * <p>
+     * 重要:必须二次验证入驻状态为 APPROVED,避免仅因高级会员身份而误发奖励。
      */
     @Transactional
     public void onLicenseApproved(Long userId) {
@@ -247,6 +261,16 @@ public class ActivityInviteService implements ActivityInviteGate {
             return;
         }
 
+        // 二次验证入驻状态:必须是 APPROVED 才发放奖励
+        Long approvedCount = businessLicenseMapper.selectCount(
+                new LambdaQueryWrapper<BusinessLicense>()
+                        .eq(BusinessLicense::getUserId, userId)
+                        .eq(BusinessLicense::getReviewStatus, LicenseStatus.APPROVED.name()));
+        if (approvedCount == null || approvedCount == 0) {
+            log.warn("被邀请人入驻状态非APPROVED,跳过邀请奖励: inviteeId={}", userId);
+            return;
+        }
+
         ActivityInviteConfig config = getConfig();
         if (!isActive(config)) {
             log.info("邀请有礼活动未开启,跳过入驻发奖: invitee={}", userId);

+ 4 - 2
zhijiayun-user/src/main/java/com/xuekairui/user/service/CrawlerService.java

@@ -281,8 +281,10 @@ public class CrawlerService {
         TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
             @Override
             public void afterCommit() {
-                if (activityEventRedisService.tryIncrementCrawlerPushedCount(userId)) {
-                    return; // 今日已推送过,跳过
+                // tryIncrementCrawlerPushedCount 返回 true 表示在每日限制内(首次比价),应该推送
+                // 返回 false 表示已超出每日限制,跳过推送
+                if (!activityEventRedisService.tryIncrementCrawlerPushedCount(userId)) {
+                    return; // 已超出每日限制,跳过
                 }
                 try {
                     activityEventRedisService.pushCrawlerConsumed(userId, count, platform,