浏览代码

增加方法

wangchuanjin 2 年之前
父节点
当前提交
3f2fccb427
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      p/public.go

+ 3 - 3
p/public.go

@@ -711,12 +711,12 @@ func HourFormat(hour int) string {
 
 //数组中的小时是否结束
 func TimesIsOver(times []string, hour int) (bool, time.Time, time.Time) {
-	sort.Strings(times)
+	now := time.Now()
 	if len(times) == 0 {
-		return false, nil, nil
+		return false, now, now
 	}
+	sort.Strings(times)
 	lastHour := util.IntAll(strings.Split(times[len(times)-1], ":"))
-	now := time.Now()
 	//跨天
 	if lastHour == 23 && hour == 0 {
 		start := time.Date(now.Year(), now.Month(), now.Day()-1, 0, 0, 0, 0, time.Local)