瀏覽代碼

Merge branch 'master' of https://git.bjtdba.com/shop/php

xialei 1 年之前
父節點
當前提交
e9813a3cfc

+ 4 - 0
app/common/model/movie/cinema/CinemaSched.php

@@ -28,10 +28,14 @@ class CinemaSched extends BaseModel
28
             $query->where('cinema_sign', $where['cinema_sign']);
28
             $query->where('cinema_sign', $where['cinema_sign']);
29
         })->when(isset($where['show_date']) && $where['show_date'], function ($query) use ($where) {
29
         })->when(isset($where['show_date']) && $where['show_date'], function ($query) use ($where) {
30
             $query->where('show_date', $where['show_date']);
30
             $query->where('show_date', $where['show_date']);
31
+        })->when(isset($where['date']) && $where['date'], function ($query) use ($where) {
32
+            $query->where('show_date', '>=', $where['date']);
31
         })->when(isset($where['relation_id']) && $where['relation_id'], function ($query) use ($where) {
33
         })->when(isset($where['relation_id']) && $where['relation_id'], function ($query) use ($where) {
32
             $query->where('relation_id', $where['relation_id']);
34
             $query->where('relation_id', $where['relation_id']);
33
         })->when(isset($where['sched_sign']) && $where['sched_sign'], function ($query) use ($where) {
35
         })->when(isset($where['sched_sign']) && $where['sched_sign'], function ($query) use ($where) {
34
             $query->where('sched_sign', $where['sched_sign']);
36
             $query->where('sched_sign', $where['sched_sign']);
37
+        })->when(isset($where['show_time']) && $where['show_time'], function ($query) use ($where) {
38
+            $query->where('show_time', '>=', $where['show_time']);
35
         });
39
         });
36
     }
40
     }
37
 }
41
 }

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

@@ -40,7 +40,7 @@ class CinemaSchedRepository extends BaseRepository
40
     public function getFilmSchedDate($film_sign)
40
     public function getFilmSchedDate($film_sign)
41
     {
41
     {
42
         $field = 'show_date';
42
         $field = 'show_date';
43
-        $where = [['film_sign', '=', $film_sign], ['show_date', '>=', strtotime(date('Y-m-d'))]];
43
+        $where = ['film_sign' => $film_sign, 'date' => strtotime(date('Y-m-d'))];
44
 
44
 
45
         $show_date = $this->dao->search(null, $where)->field([$field])->order('show_date asc')->group('show_date')->select()->toArray();
45
         $show_date = $this->dao->search(null, $where)->field([$field])->order('show_date asc')->group('show_date')->select()->toArray();
46
         foreach ($show_date as $key => $value) {
46
         foreach ($show_date as $key => $value) {
@@ -63,10 +63,10 @@ class CinemaSchedRepository extends BaseRepository
63
      * @throws \think\db\exception\DbException
63
      * @throws \think\db\exception\DbException
64
      * @throws \think\db\exception\ModelNotFoundException
64
      * @throws \think\db\exception\ModelNotFoundException
65
      */
65
      */
66
-    public function getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, $with = [], $order = 1)
66
+    public function getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, $show_time, $with = [], $order = 1)
67
     {
67
     {
68
         $field = 'sched_sign,cinema_sign,cinema_name,address,show_date,price,longitude,latitude';
68
         $field = 'sched_sign,cinema_sign,cinema_name,address,show_date,price,longitude,latitude';
69
-        $where = ['film_sign' => $film_sign, 'show_date' => $show_date];
69
+        $where = ['film_sign' => $film_sign, 'show_date' => $show_date, 'show_time' => $show_time];
70
 
70
 
71
         $cinema_sched = $this->dao->search(null, $where)->when($with, function ($query) use ($with) {
71
         $cinema_sched = $this->dao->search(null, $where)->when($with, function ($query) use ($with) {
72
             $query->with($with);
72
             $query->with($with);

+ 1 - 1
app/controller/api/movie/Movie.php

@@ -131,7 +131,7 @@ class Movie extends BaseController
131
 
131
 
132
         /** @var CinemaSchedRepository $cinemaSchedRepository */
132
         /** @var CinemaSchedRepository $cinemaSchedRepository */
133
         $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
133
         $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
134
-        return app('json')->success($cinemaSchedRepository->getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date));
134
+        return app('json')->success($cinemaSchedRepository->getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, date('H:i')));
135
     }
135
     }
136
 
136
 
137
     /**
137
     /**