|
|
@@ -105,20 +105,33 @@ class CinemaSchedRepository extends BaseRepository
|
|
105
|
105
|
* @param $cinema_sign
|
|
106
|
106
|
* @param $film_sign
|
|
107
|
107
|
* @param $show_date
|
|
|
108
|
+ * @param $show_time
|
|
108
|
109
|
* @return array
|
|
109
|
110
|
* @throws \think\db\exception\DataNotFoundException
|
|
110
|
111
|
* @throws \think\db\exception\DbException
|
|
111
|
112
|
* @throws \think\db\exception\ModelNotFoundException
|
|
112
|
113
|
*/
|
|
113
|
|
- public function getCinemaFilmSched($page, $limit, $cinema_sign, $film_sign, $show_date)
|
|
|
114
|
+ public function getCinemaFilmSched($page, $limit, $cinema_sign, $film_sign, $show_date, $show_time)
|
|
114
|
115
|
{
|
|
115
|
116
|
$field = 'relation_id,sched_sign,film_sign,film_name,show_date,show_time,cinema_sign,cinema_name,hall_sign,hall_name,price';
|
|
116
|
117
|
$where = ['cinema_sign' => $cinema_sign, 'film_sign' => $film_sign, 'show_date' => $show_date];
|
|
|
118
|
+ if ($show_date == strtotime(date('Y-m-d'))) $where['show_time'] = $show_time;
|
|
117
|
119
|
|
|
118
|
120
|
$cinema_sched = $this->dao->search(null, $where)
|
|
119
|
121
|
->when($page && $limit, function ($query) use ($page, $limit) {
|
|
120
|
122
|
$query->page($page, $limit);
|
|
121
|
123
|
})->order('show_time asc')->field([$field])->select()->toArray();
|
|
|
124
|
+
|
|
|
125
|
+ $filmList = [];
|
|
|
126
|
+ $film_sign_list = array_column($cinema_sched, 'film_sign');
|
|
|
127
|
+ if (!empty($film_sign_list)) {
|
|
|
128
|
+ $tmpFilmList = Db::name('movie_film')->whereIn('film_sign', $film_sign_list)->field('film_sign,publish_date,language,type,duration,version')->select()->toArray();
|
|
|
129
|
+ foreach ($tmpFilmList as $fKey => $fValue) {
|
|
|
130
|
+ $fValue['publish_date'] = date('Y-m-d', $fValue['publish_date']);
|
|
|
131
|
+ $filmList[$fValue['film_sign']] = $fValue;
|
|
|
132
|
+ }
|
|
|
133
|
+ }
|
|
|
134
|
+
|
|
122
|
135
|
foreach ($cinema_sched as $key => $value) {
|
|
123
|
136
|
$pcYanglaojinGongxian = MovieRepository::getPvYanglaojinScore($value['price']);
|
|
124
|
137
|
|
|
|
@@ -127,6 +140,10 @@ class CinemaSchedRepository extends BaseRepository
|
|
127
|
140
|
$cinema_sched[$key]['pv'] = $pcYanglaojinGongxian['pv'];
|
|
128
|
141
|
$cinema_sched[$key]['score'] = $pcYanglaojinGongxian['score'];
|
|
129
|
142
|
$cinema_sched[$key]['gongxian'] = $pcYanglaojinGongxian['gongxian'];
|
|
|
143
|
+
|
|
|
144
|
+ $film = $filmList[$value['film_sign']] ?? [];
|
|
|
145
|
+ $cinema_sched[$key]['end_time'] = !empty($film) ? date('H:i', (strtotime($value['show_time']) + $film['duration'] * 60)) : '';
|
|
|
146
|
+ $cinema_sched[$key]['film'] = $film;
|
|
130
|
147
|
}
|
|
131
|
148
|
|
|
132
|
149
|
$count = $this->dao->search(null, $where)->count();
|