|
|
@@ -8,6 +8,7 @@
|
|
8
|
8
|
namespace app\common\repositories\movie;
|
|
9
|
9
|
|
|
10
|
10
|
use app\common\dao\movie\order\MovieOrderDao;
|
|
|
11
|
+use app\common\model\movie\order\MovieOrder;
|
|
11
|
12
|
use app\common\repositories\BaseRepository;
|
|
12
|
13
|
use app\common\repositories\store\order\StoreOrderRepository;
|
|
13
|
14
|
use app\traits\HuiPay;
|
|
|
@@ -200,7 +201,7 @@ class MovieRepository extends BaseRepository
|
|
200
|
201
|
'mobile' => $userinfo->phone,
|
|
201
|
202
|
'order_sn' => $order_sn,
|
|
202
|
203
|
'plat_order' => $submitOrder['data']['plat_order'],
|
|
203
|
|
- 'price' => $channel_sn['price'],
|
|
|
204
|
+ 'price' => $order_price,
|
|
204
|
205
|
'number' => count($sched_seat),
|
|
205
|
206
|
'order_price' => bcadd((string)$order_price, bcmul((string)$order_price, (string)self::premium_ratio, 2), 2),
|
|
206
|
207
|
'channel_type' => $channel_sn['channel_type'],
|
|
|
@@ -258,13 +259,14 @@ class MovieRepository extends BaseRepository
|
|
258
|
259
|
$type = 0;
|
|
259
|
260
|
if ($pay_type == 'wx') $type = 2;
|
|
260
|
261
|
if (strtolower($pay_type) == 'ali') $type = 1;
|
|
|
262
|
+
|
|
261
|
263
|
$orderinfo->pay_type = $type;
|
|
|
264
|
+ $orderinfo->update_time = time();
|
|
262
|
265
|
$orderinfo->save();
|
|
263
|
266
|
|
|
264
|
267
|
return app('json')->success($res);
|
|
265
|
268
|
}
|
|
266
|
269
|
throw new ValidateException('支付失败');
|
|
267
|
|
-// return DouHuoMallFilmApiRequest::confirmOrder($orderinfo['order_sn'], $orderinfo['order_price']);
|
|
268
|
270
|
}
|
|
269
|
271
|
|
|
270
|
272
|
/**
|
|
|
@@ -394,4 +396,52 @@ class MovieRepository extends BaseRepository
|
|
394
|
396
|
|
|
395
|
397
|
return compact('premium', 'cost_price', 'pv', 'yanglaojin', 'gongxian', 'score');
|
|
396
|
398
|
}
|
|
|
399
|
+
|
|
|
400
|
+ /**
|
|
|
401
|
+ * 计算佣金分佣奖励
|
|
|
402
|
+ *
|
|
|
403
|
+ * @param $pay_type
|
|
|
404
|
+ * @param $order_sn
|
|
|
405
|
+ * @param $post_data
|
|
|
406
|
+ * @return void
|
|
|
407
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
408
|
+ * @throws \think\db\exception\DbException
|
|
|
409
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
410
|
+ */
|
|
|
411
|
+ public function updateMovieOrderAndcalculationCommissionDividendAward($pay_type, $order_sn, $post_data)
|
|
|
412
|
+ {
|
|
|
413
|
+ $orderinfo = $this->dao->getWhere(['order_sn' => $order_sn])->find();
|
|
|
414
|
+ if ($orderinfo) throw new ValidateException('订单不存在');
|
|
|
415
|
+ Db::startTrans();
|
|
|
416
|
+ $orderinfo->paid = 1;
|
|
|
417
|
+ $orderinfo->pay_time = time();
|
|
|
418
|
+ $orderinfo->pay_type = $pay_type;
|
|
|
419
|
+ $orderinfo->status = 1;
|
|
|
420
|
+ $orderinfo->channel_trade_no = $post_data['id'];
|
|
|
421
|
+ $orderinfo->pay_open_id = $post_data['expend']['open_id'];
|
|
|
422
|
+ $orderinfo->update_time = time();
|
|
|
423
|
+ // 支付方式 1支付宝 2微信
|
|
|
424
|
+ if ($pay_type == 1) {
|
|
|
425
|
+ $orderinfo->alipay_no = $post_data['out_trans_id'];
|
|
|
426
|
+ }
|
|
|
427
|
+ if ($pay_type == 2) {
|
|
|
428
|
+ $orderinfo->weixin_no = $post_data['out_trans_id'];
|
|
|
429
|
+ }
|
|
|
430
|
+ $res = $orderinfo->save();
|
|
|
431
|
+ if ($res) {
|
|
|
432
|
+ $confirmOrder = DouHuoMallFilmApiRequest::confirmOrder($orderinfo['order_sn'], $orderinfo['price']);
|
|
|
433
|
+ if (!empty($confirmOrder) && isset($confirmOrder['code']) && ($confirmOrder['code'] == ApiResponseService::DEFAULT_SUCCESS_CODE)) {
|
|
|
434
|
+ // 提交事务
|
|
|
435
|
+ Db::commit();
|
|
|
436
|
+ } else {
|
|
|
437
|
+ Db::name('log')->insert(['data' => '电影票订单支付回调向【微唯宝】--- 告知电影订单已支付失败,订单编号:' . $order_sn]);
|
|
|
438
|
+ // 回滚事务
|
|
|
439
|
+ Db::rollback();
|
|
|
440
|
+ }
|
|
|
441
|
+ } else {
|
|
|
442
|
+ Db::name('log')->insert(['data' => '汇付电影票订单支付回调--- 更新电影订单表失败,订单编号:' . $order_sn]);
|
|
|
443
|
+ // 回滚事务
|
|
|
444
|
+ Db::rollback();
|
|
|
445
|
+ }
|
|
|
446
|
+ }
|
|
397
|
447
|
}
|