Browse Source

活动导入时间格式优化3

master
wanghongjun 1 week ago
parent
commit
4f79792e12
  1. 11
      app/Imports/EventCalendarImport.php

11
app/Imports/EventCalendarImport.php

@ -71,6 +71,7 @@ class EventCalendarImport implements ToModel
$this->error[] = imports_error($this->index, 'import7');
return ;
}
$start_time = $this->excelToTime($start_time);
$start_times = strtotime($start_time);
if (!$start_times) {
$this->error[] = imports_error($this->index, 'import8');
@ -90,6 +91,7 @@ class EventCalendarImport implements ToModel
$this->error[] = imports_error($this->index, 'import11');
return ;
}
$end_time = $this->excelToTime($end_time);
$end_times = strtotime($end_time);
if (!$end_times) {
$this->error[] = imports_error($this->index, 'import12');
@ -162,4 +164,13 @@ class EventCalendarImport implements ToModel
}
return $date;
}
protected function excelToTime($time): string
{
if ($time) {
$dateTime = Date::excelToDateTimeObject($time);
return $dateTime->format('H:i:s');
}
return $time;
}
}

Loading…
Cancel
Save