Преглед изворни кода

排片日期与今天查询时间相当,加入:show_time 字段查询

family пре 1 година
родитељ
комит
61a4d4a642
1 измењених фајлова са 3 додато и 2 уклоњено
  1. 3 2
      app/common/repositories/movie/CinemaSchedRepository.php

+ 3 - 2
app/common/repositories/movie/CinemaSchedRepository.php

@@ -66,7 +66,8 @@ class CinemaSchedRepository extends BaseRepository
66 66
     public function getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, $show_time, $with = [], $order = 1)
67 67
     {
68 68
         $field = 'sched_sign,cinema_sign,cinema_name,address,show_date,price,longitude,latitude';
69
-        $where = ['film_sign' => $film_sign, 'show_date' => $show_date, 'show_time' => $show_time];
69
+        $where = ['film_sign' => $film_sign, 'show_date' => $show_date];
70
+        if ($show_date == strtotime(date('Y-m-d'))) $where['show_time'] = $show_time;
70 71
 
71 72
         $cinema_sched = $this->dao->search(null, $where)->when($with, function ($query) use ($with) {
72 73
             $query->with($with);
@@ -78,7 +79,7 @@ class CinemaSchedRepository extends BaseRepository
78 79
             if ($order == 1) {//距离最近
79 80
                 $query->order('distance asc');
80 81
             } else {//播放日期
81
-                $query->order('show_date desc');
82
+                $query->order('show_time asc');
82 83
             }
83 84
         })->field([$field])->group('cinema_sign')->select()->toArray();
84 85
         foreach ($cinema_sched as $key => $value) {