Beispiel #1
0
 /**
  * 获取增配开始时间
  * @return [$start_time, $is_nextday]
  */
 public static function get_start_time($now = null)
 {
     if (empty($now)) {
         $now = time();
     }
     $week_n = date('N', $now);
     $is_afternoon = $now > strtotime(date('Y-m-d', $now) . ' 13:00:00');
     if (in_array($week_n, [6, 7]) || $week_n == 5 && $is_afternoon) {
         $start_time = TimeHelper::zeroClockTimeOfDay(strtotime("+" . (8 - $week_n) . " day", $now));
         $is_nextday = true;
     } else {
         if ($week_n < 5 && $is_afternoon) {
             $start_time = TimeHelper::zeroClockTimeOfDay(strtotime("+1 day", $now));
             $is_nextday = true;
         } else {
             $start_time = TimeHelper::zeroClockTimeOfDay($now);
             $is_nextday = false;
         }
     }
     return ["start_time" => $start_time, "is_nextday" => $is_nextday];
 }