<?php
namespace App\Services;

class TimeService
{
  //根据时间段获取时间点
  public function TimePointsArr($start_time,$end_time,$interval_time)
  {
    if (count(explode(':', $start_time)) == 1) $start_time = date('H:i:s', $start_time / 1000);
    if (count(explode(':', $end_time)) == 1) $end_time = date('H:i:s', $end_time / 1000);
    return $this->timeArr($start_time, $end_time, $interval_time);
  }

  function timeArr($start_time, $end_time, $interval_time, $arr = [])
  {

    if (strtotime($start_time) > strtotime($end_time)) return $arr;
    $arr[] = date('H:i', strtotime($start_time));
    return $this->timeArr(date('Y-m-d H:i:s', strtotime($start_time) + ($interval_time * 60)), $end_time, $interval_time, $arr);
  }


}
