|
@@ -125,6 +125,7 @@ class UniversityEvent extends Api
|
|
|
'event_id' => $params['event_id'],
|
|
|
'order_no' => createUniqueNo('E', $user_id),
|
|
|
'pay_amount' => bcmul($info['price'], $num, 2),
|
|
|
+ 'status' => 1,
|
|
|
'create_time' => $nowTime
|
|
|
];
|
|
|
Db::startTrans();
|
|
@@ -151,66 +152,67 @@ class UniversityEvent extends Api
|
|
|
return $this->error('订单创建失败');
|
|
|
}
|
|
|
Db::commit();
|
|
|
+ return $this->success('报名成功');
|
|
|
|
|
|
- // 创建支付订单
|
|
|
- $remark = '老年大学活动报名';
|
|
|
- $orderData = [
|
|
|
- 'user_id' => $user_id,
|
|
|
- 'out_trade_no' => $data['order_no'],
|
|
|
- 'order_amount' => $data['pay_amount'],
|
|
|
- 'pay_type' => $params['pay_type'],
|
|
|
- 'platform' => $params['platform'],
|
|
|
- 'table_name' => 'university_event_apply',
|
|
|
- 'table_id' => $apply_id,
|
|
|
- 'createtime' => time(),
|
|
|
- 'args' => json_encode([
|
|
|
- 'table_id' => $apply_id,
|
|
|
- 'remark' => $remark
|
|
|
- ], JSON_UNESCAPED_UNICODE),
|
|
|
- ];
|
|
|
- if (!Db::name('pay_order')->insert($orderData)) {
|
|
|
- return $this->error('订单创建失败');
|
|
|
- }
|
|
|
-
|
|
|
- // 拉起支付 余额支付
|
|
|
- if ($params['pay_type'] == 'wallet') {
|
|
|
- Db::startTrans();
|
|
|
- //钱包更新
|
|
|
- $walletService = new Wallet();
|
|
|
- if (!$walletService->change($user_id, -$orderData['order_amount'], 'money', 20, $remark, $orderData['table_name'], $orderData['table_id'])) {
|
|
|
- Db::rollback();
|
|
|
- return $this->error($walletService->getMessage());
|
|
|
- }
|
|
|
- // 支付成功,更改支付金额
|
|
|
- [$res,$msg] = PayOrderModel::university_event($orderData['out_trade_no']);
|
|
|
- if (!$res){
|
|
|
- Db::rollback();
|
|
|
- return $this->error($msg);
|
|
|
- }
|
|
|
- Db::commit();
|
|
|
- return $this->success('支付成功');
|
|
|
- }
|
|
|
-
|
|
|
- // 第三方支付下单
|
|
|
- $params = [
|
|
|
- 'type' => $orderData['pay_type'],
|
|
|
- 'orderid' => $orderData['out_trade_no'],
|
|
|
- 'title' => $remark,
|
|
|
- 'amount' => $orderData['order_amount'],
|
|
|
- 'method' => $orderData['platform'],
|
|
|
- 'notifyurl' => CurlUtil::getHttp("/api/notify/university_event_{$params['pay_type']}"),
|
|
|
- 'returnurl' => '',
|
|
|
- ];
|
|
|
- // 如果是小程序则需要添加 openid
|
|
|
- if ($params['pay_type'] == 'wechat' && $params['platform'] == 'miniapp') {
|
|
|
- $params['openid'] = $this->auth->mini_openid;
|
|
|
- }
|
|
|
- $res = Service::submitOrder($params);
|
|
|
- if ($params['pay_type'] == 'wechat') {
|
|
|
- $this->success('success', json_decode($res, true));
|
|
|
- } else {
|
|
|
- $this->success('success', $res);
|
|
|
- }
|
|
|
+// // 创建支付订单
|
|
|
+// $remark = '老年大学活动报名';
|
|
|
+// $orderData = [
|
|
|
+// 'user_id' => $user_id,
|
|
|
+// 'out_trade_no' => $data['order_no'],
|
|
|
+// 'order_amount' => $data['pay_amount'],
|
|
|
+// 'pay_type' => $params['pay_type'],
|
|
|
+// 'platform' => $params['platform'],
|
|
|
+// 'table_name' => 'university_event_apply',
|
|
|
+// 'table_id' => $apply_id,
|
|
|
+// 'createtime' => time(),
|
|
|
+// 'args' => json_encode([
|
|
|
+// 'table_id' => $apply_id,
|
|
|
+// 'remark' => $remark
|
|
|
+// ], JSON_UNESCAPED_UNICODE),
|
|
|
+// ];
|
|
|
+// if (!Db::name('pay_order')->insert($orderData)) {
|
|
|
+// return $this->error('订单创建失败');
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 拉起支付 余额支付
|
|
|
+// if ($params['pay_type'] == 'wallet') {
|
|
|
+// Db::startTrans();
|
|
|
+// //钱包更新
|
|
|
+// $walletService = new Wallet();
|
|
|
+// if (!$walletService->change($user_id, -$orderData['order_amount'], 'money', 20, $remark, $orderData['table_name'], $orderData['table_id'])) {
|
|
|
+// Db::rollback();
|
|
|
+// return $this->error($walletService->getMessage());
|
|
|
+// }
|
|
|
+// // 支付成功,更改支付金额
|
|
|
+// [$res,$msg] = PayOrderModel::university_event($orderData['out_trade_no']);
|
|
|
+// if (!$res){
|
|
|
+// Db::rollback();
|
|
|
+// return $this->error($msg);
|
|
|
+// }
|
|
|
+// Db::commit();
|
|
|
+// return $this->success('支付成功');
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 第三方支付下单
|
|
|
+// $params = [
|
|
|
+// 'type' => $orderData['pay_type'],
|
|
|
+// 'orderid' => $orderData['out_trade_no'],
|
|
|
+// 'title' => $remark,
|
|
|
+// 'amount' => $orderData['order_amount'],
|
|
|
+// 'method' => $orderData['platform'],
|
|
|
+// 'notifyurl' => CurlUtil::getHttp("/api/notify/university_event_{$params['pay_type']}"),
|
|
|
+// 'returnurl' => '',
|
|
|
+// ];
|
|
|
+// // 如果是小程序则需要添加 openid
|
|
|
+// if ($params['pay_type'] == 'wechat' && $params['platform'] == 'miniapp') {
|
|
|
+// $params['openid'] = $this->auth->mini_openid;
|
|
|
+// }
|
|
|
+// $res = Service::submitOrder($params);
|
|
|
+// if ($params['pay_type'] == 'wechat') {
|
|
|
+// $this->success('success', json_decode($res, true));
|
|
|
+// } else {
|
|
|
+// $this->success('success', $res);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
}
|