|
@@ -228,6 +228,30 @@ class StoreOrderController
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ case "ali":
|
|
|
+ $orderInfo = StoreOrder::where('order_id', $orderId)->find();
|
|
|
+ if (!$orderInfo || !isset($orderInfo['paid'])) return app('json')->fail('支付订单不存在!');
|
|
|
+ $orderInfo = $orderInfo->toArray();
|
|
|
+ if ($orderInfo['paid']) return app('json')->fail('支付已支付!');
|
|
|
+ //支付金额为0
|
|
|
+ if (bcsub((float)$orderInfo['pay_price'], 0, 2) <= 0) {
|
|
|
+ //创建订单jspay支付
|
|
|
+ $payPriceStatus = StoreOrder::jsPayPrice($orderId, $request->uid());
|
|
|
+ if ($payPriceStatus)//0元支付成功
|
|
|
+ return app('json')->status('success', '支付成功');
|
|
|
+ else
|
|
|
+ return app('json')->status('pay_error', StoreOrder::getErrorInfo());
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ $jsConfig = OrderRepository::aliPay($orderId); //创建订单jspay
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return app('json')->status('pay_error', $e->getMessage());
|
|
|
+ }
|
|
|
+ $info['jsConfig'] = $jsConfig;
|
|
|
+ return app('json')->status('ali_pay', '订单创建成功', $info);
|
|
|
+ }
|
|
|
+ break;
|
|
|
case 'yue':
|
|
|
if (StoreOrder::yuePay($orderId, $request->uid(), $formId))
|
|
|
return app('json')->status('success', '余额支付成功', $info);
|
|
@@ -360,6 +384,29 @@ class StoreOrderController
|
|
|
else
|
|
|
return app('json')->status('success', '支付失败');
|
|
|
break;
|
|
|
+ case "ali":
|
|
|
+ $orderInfo = StoreOrder::where('order_id', $order['order_id'])->find();
|
|
|
+ if (!$orderInfo || !isset($orderInfo['paid'])) return app('json')->fail('支付订单不存在!');
|
|
|
+ $orderInfo = $orderInfo->toArray();
|
|
|
+ if ($orderInfo['paid']) return app('json')->fail('支付已支付!');
|
|
|
+ //支付金额为0
|
|
|
+ if (bcsub((float)$orderInfo['pay_price'], 0, 2) <= 0) {
|
|
|
+ //创建订单jspay支付
|
|
|
+ $payPriceStatus = StoreOrder::jsPayPrice($order['order_id'], $request->uid());
|
|
|
+ if ($payPriceStatus)//0元支付成功
|
|
|
+ return app('json')->status('success', '支付成功');
|
|
|
+ else
|
|
|
+ return app('json')->status('pay_error', StoreOrder::getErrorInfo());
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ $jsConfig = OrderRepository::aliPay($order['order_id']); //创建订单jspay
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ return app('json')->status('pay_error', $e->getMessage());
|
|
|
+ }
|
|
|
+ $info['jsConfig'] = $jsConfig;
|
|
|
+ return app('json')->status('ali_pay', '订单创建成功', $info);
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
return app('json')->fail('支付方式错误');
|
|
|
}
|