接口更新
This commit is contained in:
@@ -21,7 +21,7 @@ type TimeObject struct {
|
||||
Y bool `json:"y"`
|
||||
}
|
||||
|
||||
func GetStrDays(day int, minute int, reserveMap map[string]models.ReserveTimeFilter, orderTimeMap map[string]string, carNum int, orderNumMap map[string]int, carServiceNum int, times []string) 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, times []string, orderTimeCount map[string]int) map[string][]TimeObject {
|
||||
// 获取当前时间
|
||||
currentTime := time.Now()
|
||||
// 计算半小时后的时间
|
||||
@@ -81,7 +81,8 @@ func GetStrDays(day int, minute int, reserveMap map[string]models.ReserveTimeFil
|
||||
}
|
||||
} else {
|
||||
key := nextHour.Format("2006-01-02")
|
||||
//当前订单数小于车辆数 可接单
|
||||
key1 := nextHour.Format("2006-01-02 15:04")
|
||||
//当前订单数小于车辆数 可接单 时间范围可能会超出到11点
|
||||
if existOrderNum && orderNum < carNum*carServiceNum {
|
||||
if _, ok := dayHoursMap[key]; ok {
|
||||
dayHoursMap[key] = append(dayHoursMap[key], TimeObject{
|
||||
@@ -95,17 +96,28 @@ func GetStrDays(day int, minute int, reserveMap map[string]models.ReserveTimeFil
|
||||
}}
|
||||
}
|
||||
} else if nextHour.Hour() >= workStart && nextHour.Hour() < workEnd {
|
||||
if _, ok := dayHoursMap[key]; ok {
|
||||
//查看当前时间对应的订单数量
|
||||
orderCount := orderTimeCount[key1]
|
||||
//预约时间对应的订单数<车辆数量 当前时间可以预约
|
||||
if orderCount < carNum*carServiceNum {
|
||||
dayHoursMap[key] = append(dayHoursMap[key], TimeObject{
|
||||
Time: nextHour.Format("15:04"),
|
||||
Y: false,
|
||||
Y: true,
|
||||
})
|
||||
} else {
|
||||
dayHoursMap[key] = []TimeObject{{
|
||||
Time: nextHour.Format("15:04"),
|
||||
Y: false,
|
||||
}}
|
||||
if _, ok := dayHoursMap[key]; ok {
|
||||
dayHoursMap[key] = append(dayHoursMap[key], TimeObject{
|
||||
Time: nextHour.Format("15:04"),
|
||||
Y: false,
|
||||
})
|
||||
} else {
|
||||
dayHoursMap[key] = []TimeObject{{
|
||||
Time: nextHour.Format("15:04"),
|
||||
Y: false,
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -103,3 +103,6 @@ func TestMap(t *testing.T) {
|
||||
}
|
||||
print("12345", c1[2].Id)
|
||||
}
|
||||
func Test22(t *testing.T) {
|
||||
fmt.Println("您还需支付" + fmt.Sprintf("%.1f", float64(1298)/10.0))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user