|
|
@@ -450,30 +450,12 @@ public class LiveRedConfServiceImpl implements ILiveRedConfService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 只插入新记录(这些记录可能是从 Redis 同步过来的,但还没有插入数据库)
|
|
|
+ // 只插入新记录(这些记录是从 Redis 同步过来的,但还没有插入数据库)
|
|
|
+ // 注意:积分增加逻辑已移除,现在只能通过 claimRedPacket 方法领取红包并增加积分
|
|
|
if (CollUtil.isNotEmpty(newRecords)) {
|
|
|
try {
|
|
|
userRedRecordMapper.insertLiveUserRedRecordBatch(newRecords);
|
|
|
-
|
|
|
- // 只为新记录增加积分(避免重复增加)
|
|
|
- // 注意:如果 claimRedPacket 已经处理过,这里不应该再增加积分
|
|
|
- // 所以这里只处理那些在 claimRedPacket 中还没有处理过的记录
|
|
|
- for (LiveUserRedRecord liveUserRedRecord : newRecords) {
|
|
|
- // 再次检查:如果 claimRedPacket 已经处理过,数据库中应该有记录
|
|
|
- // 如果这里还能插入,说明 claimRedPacket 没有处理过,需要增加积分
|
|
|
- LiveUserRedRecord verifyRecord = new LiveUserRedRecord();
|
|
|
- verifyRecord.setUserId(liveUserRedRecord.getUserId());
|
|
|
- verifyRecord.setRedId(liveUserRedRecord.getRedId());
|
|
|
- List<LiveUserRedRecord> verifyRecords = userRedRecordMapper.selectLiveUserRedRecordList(verifyRecord);
|
|
|
- // 确保只有一条记录,且积分还没有增加过
|
|
|
- if (verifyRecords != null && verifyRecords.size() == 1) {
|
|
|
- // 检查积分日志,如果已经增加过积分,则不再增加
|
|
|
- // 这里简化处理:如果记录存在且只有一条,说明是新的,需要增加积分
|
|
|
- userService.incrIntegral(Collections.singletonList(liveUserRedRecord.getUserId()), liveUserRedRecord.getIntegral());
|
|
|
- // 保存用户领取芳华币记录 方便统计计算
|
|
|
- saveUserRewardRecord(liveUserRedRecord);
|
|
|
- }
|
|
|
- }
|
|
|
+ log.info("批量插入红包记录成功,redId: {}, 记录数: {}", id, newRecords.size());
|
|
|
} catch (Exception e) {
|
|
|
log.error("批量插入红包记录失败,redId: {}", id, e);
|
|
|
}
|