新增逻辑
This commit is contained in:
@@ -20,22 +20,22 @@ type TimeObject struct {
|
||||
Y bool `json:"y"`
|
||||
}
|
||||
|
||||
func GetStrDays(day int, hour int, reserveMap map[string]models.ReserveTimeFilter, orderTimeMap map[string]string, carNum int, orderNumMap map[string]int, carServiceNum int) map[string][]TimeObject {
|
||||
func GetStrDays(day int, minute int, reserveMap map[string]models.ReserveTimeFilter, orderTimeMap map[string]string, carNum int, orderNumMap map[string]int, carServiceNum int) map[string][]TimeObject {
|
||||
// 获取当前时间
|
||||
currentTime := time.Now()
|
||||
// 计算半小时后的时间
|
||||
halfHourLater := currentTime.Add(time.Duration(hour) * time.Minute)
|
||||
halfHourLater := currentTime.Add(time.Duration(minute) * time.Minute)
|
||||
|
||||
// 计算下一个整点时间
|
||||
nextHour := time.Date(
|
||||
halfHourLater.Year(),
|
||||
halfHourLater.Month(),
|
||||
halfHourLater.Day(),
|
||||
halfHourLater.Hour()+1, // 下一个整点小时
|
||||
0, // 下一个整点分钟数为0
|
||||
0, // 下一个整点秒数为0
|
||||
0, // 下一个整点纳秒数为0
|
||||
time.Local, // 下一个整点时区
|
||||
halfHourLater.Hour(), // 下一个整点小时
|
||||
0, // 下一个整点分钟数为0
|
||||
0, // 下一个整点秒数为0
|
||||
0, // 下一个整点纳秒数为0
|
||||
time.Local, // 下一个整点时区
|
||||
)
|
||||
|
||||
// 工作时间范围
|
||||
@@ -93,7 +93,7 @@ func GetStrDays(day int, hour int, reserveMap map[string]models.ReserveTimeFilte
|
||||
}
|
||||
|
||||
}
|
||||
nextHour = nextHour.Add(30 * time.Minute) // 下一个整点半时间
|
||||
nextHour = nextHour.Add(time.Duration(minute) * time.Minute) // 下一个整点半时间
|
||||
}
|
||||
return dayHoursMap
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user