|
|
@@ -619,14 +619,13 @@ public class InviteService {
|
|
|
}
|
|
|
|
|
|
// 5.1 奖励统一由活动模块处理(ActivityInviteGate),此处不再做上限校验
|
|
|
- // 6. 创建邀请关系(直接标记为已注册)
|
|
|
- int rewardMonths = config.getRewardMonths() != null ? config.getRewardMonths() : 1;
|
|
|
+ // 6. 创建邀请关系(rewardGranted 初始为 0,由活动模块实际发奖后回写)
|
|
|
InviteRelation relation = InviteRelation.builder()
|
|
|
.inviterId(inviterId)
|
|
|
.inviteeId(inviteeId)
|
|
|
.inviteCodeId(inviteCode.getId())
|
|
|
.registered(1)
|
|
|
- .rewardGranted(rewardMonths)
|
|
|
+ .rewardGranted(0)
|
|
|
.status(1)
|
|
|
.build();
|
|
|
inviteRelationMapper.insert(relation);
|
|
|
@@ -740,14 +739,13 @@ public class InviteService {
|
|
|
|
|
|
// 7.1 奖励统一由活动模块处理,此处不再做上限校验
|
|
|
|
|
|
- // 8. 创建邀请关系
|
|
|
- int rewardMonths = config.getRewardMonths() != null ? config.getRewardMonths() : 1;
|
|
|
+ // 8. 创建邀请关系(rewardGranted 初始为 0,由活动模块实际发奖后回写)
|
|
|
InviteRelation relation = InviteRelation.builder()
|
|
|
.inviterId(inviterId)
|
|
|
.inviteeId(userId)
|
|
|
.inviteCodeId(inviteCode.getId())
|
|
|
.registered(1)
|
|
|
- .rewardGranted(rewardMonths)
|
|
|
+ .rewardGranted(0)
|
|
|
.status(1)
|
|
|
.build();
|
|
|
inviteRelationMapper.insert(relation);
|
|
|
@@ -829,8 +827,8 @@ public class InviteService {
|
|
|
.filter(r -> r.getRegistered() != null && r.getRegistered() == 1)
|
|
|
.count();
|
|
|
|
|
|
- // 累计奖励会员月数
|
|
|
- int totalReward = allRelations.stream()
|
|
|
+ // 累计奖励次数(由活动模块实际发奖后回写到 InviteRelation,1 次 = 1 个月高级会员)
|
|
|
+ int totalRewardMonths = allRelations.stream()
|
|
|
.mapToInt(InviteRelation::getRewardGranted)
|
|
|
.sum();
|
|
|
|
|
|
@@ -872,10 +870,10 @@ public class InviteService {
|
|
|
summaryText = summaryTemplate
|
|
|
.replace("{totalInvited}", String.valueOf(totalInvited))
|
|
|
.replace("{registeredCount}", String.valueOf(registeredCount))
|
|
|
- .replace("{totalReward}", String.valueOf(totalReward));
|
|
|
+ .replace("{totalReward}", String.valueOf(totalRewardMonths));
|
|
|
} else {
|
|
|
summaryText = String.format("已邀请%d家药店,%d家注册,累计获得%d个月高级会员",
|
|
|
- totalInvited, registeredCount, totalReward);
|
|
|
+ totalInvited, registeredCount, totalRewardMonths);
|
|
|
}
|
|
|
|
|
|
return InviteStatsResponse.builder()
|
|
|
@@ -884,7 +882,7 @@ public class InviteService {
|
|
|
.clickedCount(clickedCount)
|
|
|
.totalInvited(totalInvited)
|
|
|
.registeredCount(registeredCount)
|
|
|
- .totalReward(totalReward)
|
|
|
+ .totalReward(totalRewardMonths)
|
|
|
.summaryText(summaryText)
|
|
|
.todayInvited(todayInvited.intValue())
|
|
|
.todayRemaining(todayRemaining)
|