|
|
@@ -101,7 +101,7 @@ class MovieRepository extends BaseRepository
|
|
101
|
101
|
foreach ($fileSchedValue as $key => $value) {
|
|
102
|
102
|
$pcYanglaojinGongxian = static::getPvYanglaojinScore($value['cost_price']);
|
|
103
|
103
|
|
|
104
|
|
- $fileSchedValue[$key]['cost_price'] = $pcYanglaojinGongxian['cost_price'];
|
|
|
104
|
+ $fileSchedValue[$key]['price'] = $pcYanglaojinGongxian['cost_price'];
|
|
105
|
105
|
$fileSchedValue[$key]['yanglaojin'] = $pcYanglaojinGongxian['yanglaojin'];
|
|
106
|
106
|
$fileSchedValue[$key]['pv'] = $pcYanglaojinGongxian['pv'];
|
|
107
|
107
|
$fileSchedValue[$key]['score'] = $pcYanglaojinGongxian['score'];
|
|
|
@@ -126,7 +126,7 @@ class MovieRepository extends BaseRepository
|
|
126
|
126
|
$schedSeatList = (isset($result['code']) && ($result['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE))
|
|
127
|
127
|
? $result['data']['list'] : [];
|
|
128
|
128
|
foreach ($schedSeatList as $key => $value) {
|
|
129
|
|
- $tmpprice = json_decode($value['price'],true);
|
|
|
129
|
+ $tmpprice = json_decode($value['price'], true);
|
|
130
|
130
|
if (isset($tmpprice['P2'])) {
|
|
131
|
131
|
$price = $tmpprice['P2'];
|
|
132
|
132
|
} elseif (isset($tmpprice['P1'])) {
|
|
|
@@ -144,6 +144,8 @@ class MovieRepository extends BaseRepository
|
|
144
|
144
|
$schedSeatList[$key]['pv'] = $pcYanglaojinGongxian['pv'];
|
|
145
|
145
|
$schedSeatList[$key]['score'] = $pcYanglaojinGongxian['score'];
|
|
146
|
146
|
$schedSeatList[$key]['gongxian'] = $pcYanglaojinGongxian['gongxian'];
|
|
|
147
|
+ $schedSeatList[$key]['relation_id'] = $relation_id; // 场次ID
|
|
|
148
|
+ $schedSeatList[$key]['sched_sign'] = $sched_sign; // 场次编码
|
|
147
|
149
|
}
|
|
148
|
150
|
|
|
149
|
151
|
return $schedSeatList;
|
|
|
@@ -151,13 +153,13 @@ class MovieRepository extends BaseRepository
|
|
151
|
153
|
|
|
152
|
154
|
/**
|
|
153
|
155
|
* 锁座订单
|
|
154
|
|
- * @param $sched_sign
|
|
155
|
|
- * @param $seat_sign
|
|
156
|
|
- * @param $channel_type
|
|
157
|
|
- * @param $third_order
|
|
158
|
|
- * @param $order_price
|
|
159
|
|
- * @param $phone
|
|
160
|
|
- * @return mixed|string
|
|
|
156
|
+ *
|
|
|
157
|
+ * @param $userinfo
|
|
|
158
|
+ * @param $params
|
|
|
159
|
+ * @return mixed
|
|
|
160
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
161
|
+ * @throws \think\db\exception\DbException
|
|
|
162
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
161
|
163
|
*/
|
|
162
|
164
|
public function submitOrder($userinfo, $params)
|
|
163
|
165
|
{
|
|
|
@@ -165,49 +167,57 @@ class MovieRepository extends BaseRepository
|
|
165
|
167
|
$storeOrder = app()->make(StoreOrderRepository::class);
|
|
166
|
168
|
$order_sn = $storeOrder->getNewOrderId() . '0';
|
|
167
|
169
|
|
|
168
|
|
- $order_price = round($params['number'] * $params['price'], 2);
|
|
169
|
|
- $submitOrder = DouHuoMallFilmApiRequest::submitOrder($userinfo->phone, $params['channel_type'], $params['sched_sign'], $order_sn, $order_price);
|
|
170
|
|
- if (!empty($submitOrder) && isset($submitOrder['code']) && ($submitOrder['code'] == 200) && isset($submitOrder['data']['plat_order'])) {
|
|
|
170
|
+ /** @var CinemaSchedRepository $cinemaSchedRepository */
|
|
|
171
|
+ $cinemaSchedRepository = app()->make(CinemaSchedRepository::class);
|
|
|
172
|
+ $sched = $cinemaSchedRepository->getCinemaSchedInfo($params['relation_id'], $params['sched_sign']);
|
|
|
173
|
+ if (empty($sched)) throw new ValidateException('观影场次不存在');
|
|
|
174
|
+
|
|
|
175
|
+ $seat_sign = json_decode($params['seat_sign'], true);
|
|
|
176
|
+ $order_price = round($sched['price'] * count($seat_sign), 2);
|
|
|
177
|
+ $submitOrder = DouHuoMallFilmApiRequest::submitOrder($userinfo->phone, $params['channel_type'], $params['sched_sign'], $seat_sign, $order_sn, $order_price);
|
|
|
178
|
+ if (!empty($submitOrder) && isset($submitOrder['code']) && ($submitOrder['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE) && isset($submitOrder['data']['plat_order'])) {
|
|
|
179
|
+ /** @var CinemaRepository $cinemaRepository */
|
|
|
180
|
+ $cinemaRepository = app()->make(CinemaRepository::class);
|
|
|
181
|
+ $cinema = $cinemaRepository->getCinemaInfo($sched['cinema_sign']);
|
|
|
182
|
+
|
|
171
|
183
|
$_order = [
|
|
172
|
184
|
'uid' => $userinfo->uid,
|
|
173
|
185
|
'mobile' => $userinfo->phone,
|
|
174
|
186
|
'order_sn' => $order_sn,
|
|
175
|
187
|
'plat_order' => $submitOrder['data']['plat_order'],
|
|
176
|
|
- 'price' => $params['price'],
|
|
177
|
|
- 'number' => $params['number'],
|
|
|
188
|
+ 'price' => $sched['price'],
|
|
|
189
|
+ 'number' => count($seat_sign),
|
|
178
|
190
|
'order_price' => $order_price,
|
|
179
|
191
|
'channel_type' => $params['channel_type'],
|
|
180
|
|
- 'pay_type' => $params['pay_type'],
|
|
181
|
|
- 'city_sign' => $params['city_sign'],
|
|
182
|
|
- 'city_name' => $params['city_name'],
|
|
183
|
|
- 'area_code' => $params['area_code'],
|
|
184
|
|
- 'area_name' => $params['area_name'],
|
|
185
|
|
- 'cinema_sign' => $params['cinema_sign'],
|
|
186
|
|
- 'cinema_name' => $params['cinema_name'],
|
|
187
|
|
- 'address' => $params['address'],
|
|
188
|
|
- 'longitude' => $params['longitude'],
|
|
189
|
|
- 'latitude' => $params['latitude'],
|
|
190
|
|
- 'hall_sign' => $params['hall_sign'],
|
|
191
|
|
- 'hall_name' => $params['hall_name'],
|
|
192
|
|
- 'relation_id' => $params['relation_id'],
|
|
193
|
|
- 'sched_sign' => $params['sched_sign'],
|
|
194
|
|
- 'film_sign' => $params['film_sign'],
|
|
195
|
|
- 'film_name' => $params['film_name'],
|
|
196
|
|
- 'show_date' => $params['show_date'],
|
|
197
|
|
- 'show_time' => $params['show_time'],
|
|
198
|
|
- 'sched_seat' => $params['sched_seat'],
|
|
|
192
|
+ 'city_sign' => $cinema['city_sign'],
|
|
|
193
|
+ 'city_name' => $cinema['city_name'],
|
|
|
194
|
+ 'area_code' => $cinema['area_sign'],
|
|
|
195
|
+ 'area_name' => $cinema['area_name'],
|
|
|
196
|
+ 'cinema_sign' => $cinema['cinema_sign'],
|
|
|
197
|
+ 'cinema_name' => $cinema['cinema_name'],
|
|
|
198
|
+ 'address' => $cinema['address'],
|
|
|
199
|
+ 'longitude' => $cinema['longitude'],
|
|
|
200
|
+ 'latitude' => $cinema['latitude'],
|
|
|
201
|
+ 'hall_sign' => $sched['hall_sign'],
|
|
|
202
|
+ 'hall_name' => $sched['hall_name'],
|
|
|
203
|
+ 'relation_id' => $sched['relation_id'],
|
|
|
204
|
+ 'sched_sign' => $sched['sched_sign'],
|
|
|
205
|
+ 'film_sign' => $sched['film_sign'],
|
|
|
206
|
+ 'film_name' => $sched['film_name'],
|
|
|
207
|
+ 'show_date' => $sched['show_date'],
|
|
|
208
|
+ 'show_time' => $sched['show_time'],
|
|
|
209
|
+ 'sched_seat' => $sched['sched_seat'],
|
|
199
|
210
|
'create_time' => time()
|
|
200
|
211
|
];
|
|
201
|
212
|
|
|
202
|
|
- $group = Db::transaction(function () use ($userinfo, $_order) {
|
|
|
213
|
+ $order_sn = Db::transaction(function () use ($userinfo, $_order) {
|
|
203
|
214
|
$_order = $this->dao->create($_order);
|
|
204
|
|
- if ($_order) return ['code' => ApiResponseService::DEFAULT_SUCCESS_CODE, 'msg' => '下单成功', 'data' => ['order_sn' => $_order['order_sn']]];
|
|
205
|
|
-
|
|
206
|
|
- throw new ValidateException('下单失败');
|
|
|
215
|
+ if ($_order) return $_order['order_sn'];
|
|
|
216
|
+ throw new ValidateException('锁座下单失败');
|
|
207
|
217
|
});
|
|
208
|
|
- return $group;
|
|
|
218
|
+ return $order_sn;
|
|
209
|
219
|
} else {
|
|
210
|
|
- return $submitOrder;
|
|
|
220
|
+ throw new ValidateException('锁座下单失败');
|
|
211
|
221
|
}
|
|
212
|
222
|
}
|
|
213
|
223
|
|