promotion:完善秒杀的 uniapp 接口

This commit is contained in:
YunaiV
2023-10-03 21:45:51 +08:00
parent ac55a9657c
commit a1e9bedf34
10 changed files with 129 additions and 139 deletions

View File

@ -79,7 +79,8 @@ public class LocalDateTimeUtils {
return false;
}
LocalDate nowDate = LocalDate.now();
return LocalDateTimeUtil.isIn(LocalDateTime.now(), LocalDateTime.of(nowDate, LocalTime.parse(startTime)),
return LocalDateTimeUtil.isIn(LocalDateTime.now(),
LocalDateTime.of(nowDate, LocalTime.parse(startTime)),
LocalDateTime.of(nowDate, LocalTime.parse(endTime)));
}
@ -98,46 +99,6 @@ public class LocalDateTimeUtils {
LocalDateTime.of(nowDate, startTime2), LocalDateTime.of(nowDate, endTime2));
}
/**
* 构建日期时间 TODO 后面有需要的话再继续扩展
*
* @author HUIHUI
*/
public static class BuilderDateTime {
/**
* 日期2023-10-01
*/
private String localDate;
/**
* 时间10:01:00
*/
private String localTime;
public BuilderDateTime() {
}
public BuilderDateTime withDate(String date) {
this.localDate = date;
return this;
}
public BuilderDateTime withDate(LocalDateTime date) {
this.localDate = LocalDateTimeUtil.format(date, "yyyy-MM-dd");
return this;
}
public BuilderDateTime withTime(String time) {
this.localTime = time;
return this;
}
public LocalDateTime build() {
return LocalDateTimeUtil.parse(this.localDate + " " + this.localTime, "yyyy-MM-dd HH:mm:ss");
}
}
/**
* 获取指定日期所在的月份的开始时间
* 例如2023-09-30 00:00:00,000