|
|
@@ -17,6 +17,7 @@ use common\components\dateUtil;
|
|
|
use common\components\freight;
|
|
|
use common\components\httpUtil;
|
|
|
use common\components\oss;
|
|
|
+use common\components\payUtil;
|
|
|
use common\components\qrCodeUtil;
|
|
|
use Yii;
|
|
|
use common\components\util;
|
|
|
@@ -201,10 +202,12 @@ class OrderController extends BaseController
|
|
|
$cgId = $order->purchaseId ?? 0;
|
|
|
$cg = PurchaseClass::getById($cgId, true);
|
|
|
$orderSn = $cg->orderSn ?? '';
|
|
|
+ $totalFee = $cg->actPrice ?? 0;
|
|
|
if (empty($orderSn)) {
|
|
|
util::complete('没有找到采购单');
|
|
|
}
|
|
|
$payWay = $cg->payWay ?? dict::getDict('payWay', 'wxPay');
|
|
|
+ $capitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
|
|
|
if ($payWay == dict::getDict('payWay', 'wxPay')) {
|
|
|
//微信付款
|
|
|
$wx = Yii::getAlias("@vendor/wxPayApi_v3.0.10");
|
|
|
@@ -222,7 +225,25 @@ class OrderController extends BaseController
|
|
|
$transactionId = $payReturn['transaction_id'] ?? '';
|
|
|
$openId = $payReturn['openid'] ?? '';
|
|
|
$aliUserId = '';
|
|
|
- PurchaseService::codePay($payWay, $orderSn, $transactionId, $openId, $aliUserId);
|
|
|
+
|
|
|
+
|
|
|
+ $cg->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $cg->codePay = 1;
|
|
|
+ $cg->payOpenId = $openId;
|
|
|
+ $cg->aliUserId = $aliUserId;
|
|
|
+ //自取订单
|
|
|
+ $cg->getType = PurchaseClass::GET_TYPE_SELF_GET;
|
|
|
+ $cg->save();
|
|
|
+
|
|
|
+ $order->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $order->codePay = 1;
|
|
|
+ //自取订单
|
|
|
+ $order->sendType = OrderClass::SEND_TYPE_NO;
|
|
|
+ $order->save();
|
|
|
+
|
|
|
+ $attach = '';
|
|
|
+ payUtil::thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
|
|
|
+
|
|
|
util::success(['returnStatus' => 'SUCCESS']);
|
|
|
} else if ($payReturn["trade_state"] == "USERPAYING") {
|
|
|
//用户支付中
|
|
|
@@ -279,7 +300,25 @@ class OrderController extends BaseController
|
|
|
$openId = '';
|
|
|
$aliUserId = $respond->buyer_user_id ?? '';
|
|
|
$transactionId = $respond->trade_no ?? '';
|
|
|
- PurchaseService::codePay($payWay, $orderSn, $transactionId, $openId, $aliUserId);
|
|
|
+
|
|
|
+ $cg->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $cg->codePay = 1;
|
|
|
+ $cg->payOpenId = $openId;
|
|
|
+ $cg->aliUserId = $aliUserId;
|
|
|
+ //自取订单
|
|
|
+ $cg->getType = PurchaseClass::GET_TYPE_SELF_GET;
|
|
|
+ $cg->save();
|
|
|
+
|
|
|
+ $order->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $order->codePay = 1;
|
|
|
+ //自取订单
|
|
|
+ $order->sendType = OrderClass::SEND_TYPE_NO;
|
|
|
+ $order->save();
|
|
|
+
|
|
|
+ $attach = '';
|
|
|
+ payUtil::thirdPay($payWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
|
|
|
+
|
|
|
+
|
|
|
util::success(['returnStatus' => 'SUCCESS']);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -328,12 +367,14 @@ class OrderController extends BaseController
|
|
|
$subject = '购买商品';
|
|
|
$totalAmount = $totalFee;
|
|
|
$body = "门店";
|
|
|
+ $capitalType = dict::getDict('capitalType', 'xhPurchase', 'id');
|
|
|
|
|
|
if ($isWx) {
|
|
|
|
|
|
- $order->payWay = dict::getDict('payWay', 'wxPay');
|
|
|
+ $wxPayWay = dict::getDict('payWay', 'wxPay');
|
|
|
+ $order->payWay = $wxPayWay;
|
|
|
$order->save();
|
|
|
- $cg->payWay = dict::getDict('payWay', 'wxPay');
|
|
|
+ $cg->payWay = $wxPayWay;
|
|
|
$cg->save();
|
|
|
|
|
|
$wx = Yii::getAlias("@vendor/wxPayApi_v3.0.10");
|
|
|
@@ -355,8 +396,25 @@ class OrderController extends BaseController
|
|
|
$transactionId = $res['transaction_id'] ?? '';
|
|
|
$openId = $res['openid'] ?? '';
|
|
|
$aliUserId = '';
|
|
|
- $payWay = dict::getDict('payWay', 'wxPay');
|
|
|
- PurchaseService::codePay($payWay, $orderSn, $transactionId, $openId, $aliUserId);
|
|
|
+
|
|
|
+ $cg->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $cg->codePay = 1;
|
|
|
+ $cg->payOpenId = $openId;
|
|
|
+ $cg->aliUserId = $aliUserId;
|
|
|
+ //自取订单
|
|
|
+ $cg->getType = PurchaseClass::GET_TYPE_SELF_GET;
|
|
|
+ $cg->save();
|
|
|
+
|
|
|
+ $order->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $order->codePay = 1;
|
|
|
+ //自取订单
|
|
|
+ $order->sendType = OrderClass::SEND_TYPE_NO;
|
|
|
+ $order->save();
|
|
|
+
|
|
|
+ $attach = '';
|
|
|
+ payUtil::thirdPay($wxPayWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
|
|
|
+
|
|
|
+
|
|
|
util::success(['returnStatus' => 'SUCCESS']);
|
|
|
}
|
|
|
util::success(['returnStatus' => 'FAILURE']);
|
|
|
@@ -419,7 +477,24 @@ class OrderController extends BaseController
|
|
|
$openId = '';
|
|
|
$aliUserId = $respond->buyer_user_id ?? '';
|
|
|
$transactionId = $respond->trade_no ?? '';
|
|
|
- PurchaseService::codePay($aliPayWay, $orderSn, $transactionId, $openId, $aliUserId);
|
|
|
+
|
|
|
+ $cg->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $cg->codePay = 1;
|
|
|
+ $cg->payOpenId = $openId;
|
|
|
+ $cg->aliUserId = $aliUserId;
|
|
|
+ //自取订单
|
|
|
+ $cg->getType = PurchaseClass::GET_TYPE_SELF_GET;
|
|
|
+ $cg->save();
|
|
|
+
|
|
|
+ $order->onlinePay = dict::getDict('onlinePay', 'yes');
|
|
|
+ $order->codePay = 1;
|
|
|
+ //自取订单
|
|
|
+ $order->sendType = OrderClass::SEND_TYPE_NO;
|
|
|
+ $order->save();
|
|
|
+
|
|
|
+ $attach = '';
|
|
|
+ payUtil::thirdPay($aliPayWay, $capitalType, $orderSn, $totalFee, $attach, $transactionId);
|
|
|
+
|
|
|
util::success(['returnStatus' => 'SUCCESS']);
|
|
|
}
|
|
|
util::success(['returnStatus' => 'FAILURE']);
|