Browse Source

活动行事历日期列表优化、编辑导入优化

master
wanghongjun 7 days ago
parent
commit
ad4ca33caa
  1. 4
      app/Http/Controllers/Admin/EventCalendarController.php
  2. 2
      app/Imports/EventCalendarImport.php
  3. 2
      app/Services/EventCalendarService.php

4
app/Http/Controllers/Admin/EventCalendarController.php

@ -426,7 +426,7 @@ class EventCalendarController extends BaseController
$days = get_year_month_days($year_month);
$items = [];
$year_month_times = strtotime($year_month);
$statusArr = [0, 1];
$statusArr = [0, 1, 2];
foreach ($days as $day) {
$date = date("Y-m", $year_month_times) . '-' . $day;
$count = EventCalendar::query()->whereIn('status', $statusArr)
@ -473,7 +473,7 @@ class EventCalendarController extends BaseController
$start_date = date("Y-m-d", $date_times);
$start_time = $start_date . ' 00:00:00';
$end_time = $start_date . ' 23:59:59';
$statusIndexArr = [0, 1];
$statusIndexArr = [0, 1, 2];
$query->whereIn('status', $statusIndexArr);
$query->where(

2
app/Imports/EventCalendarImport.php

@ -140,7 +140,7 @@ class EventCalendarImport implements ToModel
return $model->whereIn('status', [0, 1])
->where(function ($query) use ($datetime) {
$query->whereRaw(
"'{$datetime}' BETWEEN start_time AND end_time"
"'{$datetime}' >= start_time AND '{$datetime}' < end_time"
);
})
->exists();

2
app/Services/EventCalendarService.php

@ -101,7 +101,7 @@ class EventCalendarService extends BaseService
$exists = $model->whereIn('status', [0, 1])
->where(function ($query) use ($start_time) {
$query->whereRaw(
"'{$start_time}' BETWEEN start_time AND end_time"
"'{$start_time}' >= start_time AND '{$start_time}' < end_time"
);
})
->exists();

Loading…
Cancel
Save