优化获取秒杀活动

This commit is contained in:
paulGao 2022-07-27 22:13:56 +08:00
parent ed976e90dc
commit 40bf6d3010

View File

@ -339,7 +339,7 @@ public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, Sec
Arrays.sort(hoursSored); Arrays.sort(hoursSored);
for (int i = 0; i < hoursSored.length; i++) { for (int i = 0; i < hoursSored.length; i++) {
SeckillTimelineVO tempTimeline = new SeckillTimelineVO(); SeckillTimelineVO tempTimeline = new SeckillTimelineVO();
boolean hoursSoredHour = (hoursSored[i] >= hour || ((i + 1) < hoursSored.length && hoursSored[i + 1] > hour) || hoursSored.length == 1); boolean hoursSoredHour = (hoursSored[i] >= hour || i + 1 == hoursSored.length);
if (hoursSoredHour) { if (hoursSoredHour) {
SimpleDateFormat format = new SimpleDateFormat(DatePattern.NORM_DATE_PATTERN); SimpleDateFormat format = new SimpleDateFormat(DatePattern.NORM_DATE_PATTERN);
String date = format.format(new Date()); String date = format.format(new Date());