邀请用户得到金币 新增计入排行榜逻辑

This commit is contained in:
tianfeng 2026-03-05 14:56:49 +08:00
parent 12a3ed0985
commit 880061a6e6
3 changed files with 25 additions and 10 deletions

View File

@ -358,16 +358,6 @@ public class TaskListener implements MessageListener {
}
private void dealRechargeCommission(TaskApprovalEvent eventBody) {
if (StringUtils.isNotBlank(eventBody.getSysOrigin()) && eventBody.getCurrencyDiff() > 0L) {
try {
inviteUserGateway.getRechargeCommission(BigDecimal.valueOf(eventBody.getCurrencyDiff()), eventBody.getSysOrigin(), eventBody.getUserId());
} catch (Exception e) {
log.error("被邀请人充值邀请人获得佣金累计错误: {}", Throwables.getStackTraceAsString(e));
}
}
}
private void handleTask7(TaskApprovalEvent eventBody) {
log.warn("处理任务-10 加入3个房间: {}", eventBody);
// // 进入一次 +1

View File

@ -52,6 +52,8 @@ public enum RankingActivityType {
CHRISTMAS(12, "圣诞节活动", "统计送礼物消费排行"),
RAMADAN(13, "'斋月活动'", "'统计送礼物消费排行'"),
INVITE(14, "'邀请活动'", "'邀请用户奖励金币排行'"),
;
/**

View File

@ -5,11 +5,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
import com.red.circle.other.domain.model.user.UserProfile;
import com.red.circle.other.domain.ranking.RankingActivityType;
import com.red.circle.other.domain.ranking.RankingCycleType;
import com.red.circle.other.domain.ranking.RankingDimension;
import com.red.circle.other.infra.database.mongo.entity.activity.RankingActivityRecord;
import com.red.circle.other.infra.database.rds.dao.user.user.UserInviteUserDAO;
import com.red.circle.other.infra.database.rds.entity.user.user.InviteUserRechargeCommission;
import com.red.circle.other.infra.database.rds.entity.user.user.OneTimeTask;
import com.red.circle.other.infra.database.rds.entity.user.user.UserInviteUser;
import com.red.circle.other.infra.database.rds.service.user.user.OneTimeTaskService;
import com.red.circle.other.infra.gateway.RankingActivityGateway;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.tool.core.date.TimestampUtils;
import com.red.circle.other.domain.gateway.user.ability.InviteUserGateway;
@ -26,6 +31,7 @@ import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
import com.red.circle.wallet.inner.model.cmd.GoldReceiptCmd;
import com.red.circle.wallet.inner.model.enums.GoldOrigin;
@ -50,6 +56,7 @@ public class InviteUserGatewayImpl implements InviteUserGateway {
private final UserProfileGateway userProfileGateway;
private final InviteUserRechargeCommissionService inviteUserRechargeCommissionService;
private final OneTimeTaskService oneTimeTaskService;
private final RankingActivityGateway rankingActivityGateway;
/**
* 被邀请人充值邀请人获得佣金
@ -113,8 +120,24 @@ public class InviteUserGatewayImpl implements InviteUserGateway {
}
awardCommission(sysOrigin, userInviteUser.getUserId(), commission, userInviteUser.getInviteUserId());
recordRanking(userInviteUser.getUserId(), commission.longValue());
}
private void recordRanking(Long userId, Long quantity) {
RankingActivityRecord record = new RankingActivityRecord();
record.setSysOrigin(SysOriginPlatformEnum.LIKEI.name());
record.setUserId(userId);
record.setUserSex(1);
record.setActivityType(RankingActivityType.INVITE);
record.setCycleType(RankingCycleType.WEEKLY);
record.setCycleKey(ZonedDateTimeAsiaRiyadhUtils.nowWeekMondayToInt().toString());
record.setDimension(RankingDimension.CONSUME_AMOUNT);
record.setExpiredTime(new Timestamp(System.currentTimeMillis() + 30L * 24 * 60 * 60 * 1000));
// 累计数据
rankingActivityGateway.accumulateRankingData(record, quantity);
}
/**
* 奖励佣金
*