Quellcode durchsuchen

根据影片排片日期查询排片影院、根据影院影片场次日期查询场次列表

family vor 1 Jahr
Ursprung
Commit
522e0bd6f9

+ 7 - 4
app/common/repositories/movie/CinemaSchedRepository.php

@@ -47,7 +47,7 @@ class CinemaSchedRepository extends BaseRepository
47 47
             $show_date[$key]['date'] = date('m-d', $value['show_date']);
48 48
         }
49 49
 
50
-        return compact('show_date');
50
+        return $show_date;
51 51
     }
52 52
 
53 53
     /**
@@ -65,7 +65,7 @@ class CinemaSchedRepository extends BaseRepository
65 65
      */
66 66
     public function getFilmSched($page, $limit, $film_sign, $longitude, $latitude, $show_date, $with = [], $order = 1)
67 67
     {
68
-        $field = 'cinema_sign,cinema_name,address,cost_price,longitude,latitude';
68
+        $field = 'sched_sign,cinema_sign,cinema_name,address,show_date,cost_price,longitude,latitude';
69 69
         $where = ['film_sign' => $film_sign, 'show_date' => $show_date];
70 70
 
71 71
         $cinema_sched = $this->dao->search(null, $where)->when($with, function ($query) use ($with) {
@@ -83,6 +83,10 @@ class CinemaSchedRepository extends BaseRepository
83 83
         })->field([$field])->select()->toArray();
84 84
         foreach ($cinema_sched as $key => $value) {
85 85
             $cinema_sched[$key]['distance'] = isset($value['distance']) ? round($value['distance'] / 1000, 2) : 0.00;
86
+            $cinema_sched[$key]['show_date'] = date('m-d', $value['show_date']);
87
+
88
+            $pcYanglaojinGongxian = MovieRepository::getPvYanglaojinScore($value['cost_price']);
89
+            $cinema_sched[$key]['cost_price'] = $pcYanglaojinGongxian['cost_price'];
86 90
         }
87 91
 
88 92
         $count = $this->dao->search(null, $where)->when($with, function ($query) use ($with) {
@@ -108,7 +112,7 @@ class CinemaSchedRepository extends BaseRepository
108 112
     public function getCinemaFilmSched($page, $limit, $cinema_sign, $film_sign, $show_date)
109 113
     {
110 114
         $field = 'relation_id,sched_sign,film_sign,film_name,show_date,show_time,cinema_sign,cinema_name,hall_sign,hall_name,cost_price';
111
-        $where = ['cinema_sign' => $cinema_sign, 'film_sign' => $film_sign, 'show_date' => $show_date];
115
+        $where = ['cinema_sign' => $cinema_sign, 'film_sign' => $film_sign, 'show_date' => strtotime($show_date)];
112 116
 
113 117
         $cinema_sched = $this->dao->search(null, $where)
114 118
             ->when($page && $limit, function ($query) use ($page, $limit) {
@@ -122,7 +126,6 @@ class CinemaSchedRepository extends BaseRepository
122 126
             $cinema_sched[$key]['pv'] = $pcYanglaojinGongxian['pv'];
123 127
             $cinema_sched[$key]['score'] = $pcYanglaojinGongxian['score'];
124 128
             $cinema_sched[$key]['gongxian'] = $pcYanglaojinGongxian['gongxian'];
125
-            $cinema_sched[$key]['distance'] = isset($value['distance']) ? round($value['distance'] / 1000, 2) : 0.00;
126 129
         }
127 130
 
128 131
         $count = $this->dao->search(null, $where)->count();

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

@@ -153,7 +153,7 @@ class Movie extends BaseController
153 153
 
154 154
         /** @var CinemaSchedRepository $cinemaSchedRepository */
155 155
         $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
156
-        return app('json')->success($cinemaSchedRepository->getCinemaFilmSched($page, $limit, $cinema_sign, $film_sign, $show_date));
156
+        return app('json')->success($cinemaSchedRepository->getCinemaFilmSched($page, $limit, $cinema_sign, $film_sign, date('Y') . '-' . $show_date));
157 157
     }
158 158
 
159 159
     /**

+ 2 - 2
route/api.php

@@ -1276,8 +1276,8 @@ Route::group('api/', function () {
1276 1276
         Route::get('cinema', '/getCinema'); // 影院列表
1277 1277
         Route::get('film', '/getFilm'); // 影片列表
1278 1278
         Route::get('filmsched_date', '/getFilmSchedDate'); // 影片场次日期
1279
-        Route::get('film_sched', '/getFilmSched'); // 影片场次排片影院列表
1280
-        Route::get('cinemafilm_sched', '/getCinemaFilmSched'); // 影院影片场次列表
1279
+        Route::get('film_sched', '/getFilmSched'); // 根据影片排片日期查询排片影院
1280
+        Route::get('cinemafilm_sched', '/getCinemaFilmSched'); // 根据影院影片场次日期查询场次列表
1281 1281
         Route::get('sched_seat', '/getSchedSeat');
1282 1282
     })->prefix('api.movie.Movie');
1283 1283