|
@ -117,32 +117,16 @@ func isInDayOfMonth(t time.Time, ta TimeArrow) bool { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// var isInTimeOfDayCacheBool sync.Map
|
|
|
|
|
|
|
|
|
|
|
|
func isInTimeOfDay(t time.Time, ta TimeArrow) bool { |
|
|
func isInTimeOfDay(t time.Time, ta TimeArrow) bool { |
|
|
|
|
|
|
|
|
if len(ta.TimesOnDay) == 0 { |
|
|
if len(ta.TimesOnDay) == 0 { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
tfdate := t.Format("2006-01-02 15:04:05") |
|
|
|
|
|
|
|
|
|
|
|
var err error |
|
|
|
|
|
// tmp, err := json.Marshal(ta.TimesOnDay)
|
|
|
|
|
|
// mainKey := fmt.Sprintf("[%s][%s]", tfdate, string(tmp))
|
|
|
|
|
|
|
|
|
|
|
|
// value, ok := isInTimeOfDayCacheBool.Load(mainKey)
|
|
|
|
|
|
// if ok && err == nil {
|
|
|
|
|
|
// ret := value.(int)
|
|
|
|
|
|
// if ret == 3 {
|
|
|
|
|
|
// // return true
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if ret == 4 {
|
|
|
|
|
|
// return false
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
tfdate := t.Format("2006-01-02") |
|
|
|
|
|
|
|
|
parseInLocationCache := map[string]time.Time{} |
|
|
parseInLocationCache := map[string]time.Time{} |
|
|
|
|
|
var err error |
|
|
for k := range ta.TimesOnDay { |
|
|
for k := range ta.TimesOnDay { |
|
|
tsp := strings.Split(ta.TimesOnDay[k], "-") |
|
|
tsp := strings.Split(ta.TimesOnDay[k], "-") |
|
|
if len(tsp) < 2 { |
|
|
if len(tsp) < 2 { |
|
@ -197,11 +181,9 @@ func isInTimeOfDay(t time.Time, ta TimeArrow) bool { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (t.After(startTime) || t.Equal(startTime)) && t.Before(endTime) { |
|
|
if (t.After(startTime) || t.Equal(startTime)) && t.Before(endTime) { |
|
|
// isInTimeOfDayCacheBool.Store(mainKey, 3)
|
|
|
|
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// isInTimeOfDayCacheBool.Store(mainKey, 4)
|
|
|
|
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|