ソースを参照

获取场次座位

family 1 年間 前
コミット
060e35e39c
共有3 個のファイルを変更した29 個の追加4 個の削除を含む
  1. 26 1
      app/common/repositories/movie/MovieRepository.php
  2. 2 2
      app/controller/api/movie/Movie.php
  3. 1 1
      route/api.php

+ 26 - 1
app/common/repositories/movie/MovieRepository.php

@@ -121,7 +121,32 @@ class MovieRepository extends BaseRepository
121 121
      */
122 122
     public function getSchedSeat($relation_id = '', $sched_sign = '')
123 123
     {
124
-        return DouHuoMallFilmApiRequest::getSchedSeat($relation_id, $sched_sign);
124
+        $result = DouHuoMallFilmApiRequest::getSchedSeat($relation_id, $sched_sign);
125
+
126
+        $schedSeatList = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
127
+            ? $result['data']['list'] : [];
128
+        foreach ($schedSeatList as $key => $value) {
129
+            $tmpprice = json_decode($value['price'],true);
130
+            if (isset($tmpprice['P2'])) {
131
+                $price = $tmpprice['P2'];
132
+            } elseif (isset($tmpprice['P1'])) {
133
+                $price = $tmpprice['P1'];
134
+            } elseif (isset($tmpprice['P0'])) {
135
+                $price = $tmpprice['P0'];
136
+            } else {
137
+                $price = 0.00;
138
+            }
139
+            unset($schedSeatList[$key]['price']);
140
+
141
+            $pcYanglaojinGongxian = self::getPvYanglaojinScore($price);
142
+            $schedSeatList[$key]['price'] = $pcYanglaojinGongxian['cost_price'];
143
+            $schedSeatList[$key]['yanglaojin'] = $pcYanglaojinGongxian['yanglaojin'];
144
+            $schedSeatList[$key]['pv'] = $pcYanglaojinGongxian['pv'];
145
+            $schedSeatList[$key]['score'] = $pcYanglaojinGongxian['score'];
146
+            $schedSeatList[$key]['gongxian'] = $pcYanglaojinGongxian['gongxian'];
147
+        }
148
+
149
+        return $schedSeatList;
125 150
     }
126 151
 
127 152
     /**

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

@@ -164,10 +164,10 @@ class Movie extends BaseController
164 164
     public function getSchedSeat()
165 165
     {
166 166
         $relation_id = $this->request->param('relation_id', '');
167
-        if (empty($cinema_sign)) return app('json')->fail('请选择场次');
167
+        if (empty($relation_id)) return app('json')->fail('请选择观影场次');
168 168
 
169 169
         $sched_sign = $this->request->param('sched_sign', '');
170
-        if (empty($film_sign)) return app('json')->fail('请选择场次');
170
+        if (empty($sched_sign)) return app('json')->fail('请选择观影场次');
171 171
 
172 172
         return app('json')->success($this->repository->getSchedSeat($relation_id, $sched_sign));
173 173
     }

+ 1 - 1
route/api.php

@@ -1278,7 +1278,7 @@ Route::group('api/', function () {
1278 1278
         Route::get('filmsched_date', '/getFilmSchedDate'); // 影片场次日期
1279 1279
         Route::get('film_sched', '/getFilmSched'); // 根据影片排片日期查询排片影院
1280 1280
         Route::get('cinemafilm_sched', '/getCinemaFilmSched'); // 根据影院影片场次日期查询场次列表
1281
-        Route::get('sched_seat', '/getSchedSeat');
1281
+        Route::get('sched_seat', '/getSchedSeat'); // 获取场次座位
1282 1282
     })->prefix('api.movie.Movie');
1283 1283
 
1284 1284
     //电影 - 下单业务