|
@@ -17,6 +17,7 @@ import com.td.boss.game.comusers.vo.ComUsersVo;
|
|
|
import com.td.boss.util.CopyUtil;
|
|
import com.td.boss.util.CopyUtil;
|
|
|
import com.td.boss.util.RedisData;
|
|
import com.td.boss.util.RedisData;
|
|
|
import com.td.boss.util.RedisLock;
|
|
import com.td.boss.util.RedisLock;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -24,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
@Service
|
|
|
public class ComCntToSnbServiceImpl extends CommonServiceImpl<ComCntToSnbVo, ComCntToSnb, Integer> implements ComCntToSnbService {
|
|
public class ComCntToSnbServiceImpl extends CommonServiceImpl<ComCntToSnbVo, ComCntToSnb, Integer> implements ComCntToSnbService {
|
|
|
|
|
|
|
@@ -73,15 +75,17 @@ public class ComCntToSnbServiceImpl extends CommonServiceImpl<ComCntToSnbVo, Com
|
|
|
}
|
|
}
|
|
|
// 计算本次可领天数. 服务器时间 - 开始时间 - 已领取天数
|
|
// 计算本次可领天数. 服务器时间 - 开始时间 - 已领取天数
|
|
|
Integer day = Convert.toInt(DateUtil.betweenDay(comCntToSnb.getBeginTime(), serverDate, true)) - comCntToSnb.getReceivedDay() + 1;
|
|
Integer day = Convert.toInt(DateUtil.betweenDay(comCntToSnb.getBeginTime(), serverDate, true)) - comCntToSnb.getReceivedDay() + 1;
|
|
|
- System.out.println("领取开始时间:" + DateUtil.format(comCntToSnb.getBeginTime(), "yyyy-MM-dd"));
|
|
|
|
|
- System.out.println("服务器时间:" + DateUtil.format(serverDate, "yyyy-MM-dd"));
|
|
|
|
|
- System.out.println("已领取:" + comCntToSnb.getReceivedDay() + "天,本次可领取:" + day + "天");
|
|
|
|
|
|
|
+ log.info("领取人:" + userId);
|
|
|
|
|
+ log.info("领取开始时间:" + DateUtil.format(comCntToSnb.getBeginTime(), "yyyy-MM-dd"));
|
|
|
|
|
+ log.info("服务器时间:" + DateUtil.format(serverDate, "yyyy-MM-dd"));
|
|
|
|
|
+ log.info("已领取:" + comCntToSnb.getReceivedDay() + "天,本次领取天数:" + day + "天");
|
|
|
if (day <= 0) {
|
|
if (day <= 0) {
|
|
|
return Result.of(null, false, "领取失败,今日已领取");
|
|
return Result.of(null, false, "领取失败,今日已领取");
|
|
|
}
|
|
}
|
|
|
// 特例:领取周期100天,这个人间隔100以后上线
|
|
// 特例:领取周期100天,这个人间隔100以后上线
|
|
|
if (day > comCntToSnb.getTotalDay() - comCntToSnb.getReceivedDay()) {
|
|
if (day > comCntToSnb.getTotalDay() - comCntToSnb.getReceivedDay()) {
|
|
|
day = comCntToSnb.getTotalDay() - comCntToSnb.getReceivedDay();
|
|
day = comCntToSnb.getTotalDay() - comCntToSnb.getReceivedDay();
|
|
|
|
|
+ log.info("由于本次领取天数大于剩余领取天数,所以最终领取天数:" + day);
|
|
|
}
|
|
}
|
|
|
long time = System.currentTimeMillis() + RedisData.getSnbTimeout();
|
|
long time = System.currentTimeMillis() + RedisData.getSnbTimeout();
|
|
|
String redisKey = StrUtil.format("SNB_SAVE_{}", userId);
|
|
String redisKey = StrUtil.format("SNB_SAVE_{}", userId);
|