贵族每日金币兼容COUPON方式
This commit is contained in:
parent
fdbef21d26
commit
f2a73010b4
@ -241,7 +241,8 @@ public class DailyTask {
|
||||
List<Long> processedUsers = Lists.newArrayList(); // 记录已处理的用户,避免重复发放
|
||||
|
||||
commodityList.forEach(propsStoreCommodity -> {
|
||||
List<PropsBackpack> propsBackpackList = propsBackpackService.listUsersByNobleVipAndPropsId(PropsCommodityType.NOBLE_VIP, propsStoreCommodity.getPropsResources().getId());
|
||||
Long propsId = propsStoreCommodity.getPropsResources().getId();
|
||||
List<PropsBackpack> propsBackpackList = propsBackpackService.listUsersByNobleVipAndPropsId(PropsCommodityType.NOBLE_VIP, propsId);
|
||||
log.info("VIP用户: {}", JSON.toJSONString(propsBackpackList));
|
||||
|
||||
// 提取用户ID列表
|
||||
@ -251,7 +252,7 @@ public class DailyTask {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询用户是否处于可赠送金币区间
|
||||
List<Long> eligibleUsers = getEligibleGiftUsers(allUsers);
|
||||
List<Long> eligibleUsers = getEligibleGiftUsers(allUsers, propsId);
|
||||
|
||||
// 给每个用户发送奖励,排除已处理的用户
|
||||
for (Long userId : eligibleUsers) {
|
||||
@ -301,7 +302,7 @@ public class DailyTask {
|
||||
* 2. 如果当前时间在范围内则为有效赠送用户
|
||||
* 3. 如果没有PURCHASING_GOLD_PROPS类型,则其余不赠送
|
||||
*/
|
||||
private List<Long> getEligibleGiftUsers(List<Long> allUsers) {
|
||||
private List<Long> getEligibleGiftUsers(List<Long> allUsers, Long propsId) {
|
||||
if (CollectionUtils.isEmpty(allUsers)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
@ -310,7 +311,7 @@ public class DailyTask {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
for (Long userId : allUsers) {
|
||||
if (isUserEligibleForGift(userId, now)) {
|
||||
if (isUserEligibleForGift(userId, now, propsId)) {
|
||||
eligibleUsers.add(userId);
|
||||
}
|
||||
}
|
||||
@ -322,11 +323,12 @@ public class DailyTask {
|
||||
/**
|
||||
* 判断单个用户是否符合赠送条件
|
||||
*/
|
||||
private boolean isUserEligibleForGift(Long userId, LocalDateTime currentTime) {
|
||||
private boolean isUserEligibleForGift(Long userId, LocalDateTime currentTime, Long propsId) {
|
||||
try {
|
||||
// 查询用户NOBLE_VIP类型的所有流水记录
|
||||
List<RunningWaterUserProps> allRecords = runningWaterUserPropsService.query()
|
||||
.eq(RunningWaterUserProps::getUserId, userId)
|
||||
.eq(RunningWaterUserProps::getPropsId, propsId)
|
||||
.eq(RunningWaterUserProps::getType, "NOBLE_VIP")
|
||||
.orderByAsc(RunningWaterUserProps::getCreateTime)
|
||||
.list();
|
||||
|
||||
@ -412,7 +412,6 @@ public class PropsBackpackServiceImpl extends
|
||||
return query()
|
||||
.eq(PropsBackpack::getType, propsType)
|
||||
.eq(PropsBackpack::getPropsId, propsId)
|
||||
.eq(PropsBackpack::getUseProps, Boolean.TRUE)
|
||||
.gt(PropsBackpack::getExpireTime, TimestampUtils.now())
|
||||
.list()
|
||||
.stream()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user