|
|
@@ -33,20 +33,20 @@ class OrderController extends BaseController
|
|
|
$id = isset($get['id']) ? $get['id'] : 0;
|
|
|
$order = OrderClass::getById($id, true);
|
|
|
if (empty($order)) {
|
|
|
- util::fail('没有找到订单');
|
|
|
+ util::complete('没有找到订单');
|
|
|
}
|
|
|
if ($order->status != OrderClass::ORDER_STATUS_UN_PAY) {
|
|
|
if ($order->status == OrderClass::ORDER_STATUS_COMPLETE) {
|
|
|
- util::fail('订单已付款');
|
|
|
+ util::complete('订单已付款');
|
|
|
}
|
|
|
- util::fail('订单不是待付款状态');
|
|
|
+ util::complete('订单不是待付款状态');
|
|
|
}
|
|
|
OrderClass::valid($order, $this->shopId);
|
|
|
$cgId = $order->purchaseId ?? 0;
|
|
|
$cg = PurchaseClass::getById($cgId, true);
|
|
|
$orderSn = $cg->orderSn ?? '';
|
|
|
if (empty($orderSn)) {
|
|
|
- util::fail('没有找到采购单');
|
|
|
+ util::complete('没有找到采购单');
|
|
|
}
|
|
|
$payWay = $cg->payWay ?? dict::getDict('payWay', 'wxPay');
|
|
|
if ($payWay == dict::getDict('payWay', 'wxPay')) {
|
|
|
@@ -69,14 +69,14 @@ class OrderController extends BaseController
|
|
|
util::success(['returnStatus' => 'SUCCESS']);
|
|
|
} else if ($payReturn["trade_state"] == "USERPAYING") {
|
|
|
//用户支付中
|
|
|
- util::fail('正在付款,请稍候再试');
|
|
|
+ util::complete('正在付款,请稍候再试');
|
|
|
}
|
|
|
}
|
|
|
if ($payReturn["err_code"] == "ORDERNOTEXIST") {
|
|
|
//交易订单号不存在
|
|
|
- util::fail('订单没有发起过支付');
|
|
|
+ util::complete('订单没有发起过支付');
|
|
|
} else {
|
|
|
- util::fail('系统错误,请稍候再试');
|
|
|
+ util::complete('系统错误,请稍候再试');
|
|
|
}
|
|
|
} elseif ($payWay == dict::getDict('payWay', 'alipay')) {
|
|
|
//支付宝付款
|
|
|
@@ -104,7 +104,8 @@ class OrderController extends BaseController
|
|
|
util::fail('没有找到采购单');
|
|
|
}
|
|
|
//付款码
|
|
|
- $authCode = (string)$get['authCode'] ?? '';
|
|
|
+ //$authCode = (string)$get['authCode'] ?? '';
|
|
|
+ $authCode = '135188925086652713';
|
|
|
if (empty($authCode)) {
|
|
|
util::fail('支付失败');
|
|
|
}
|
|
|
@@ -146,19 +147,18 @@ class OrderController extends BaseController
|
|
|
|
|
|
$microPay = new \MicroPay();
|
|
|
$res = $microPay->pay($input, $sjExtend);
|
|
|
- Yii::info(json_encode($res));
|
|
|
- if (isset($res["return_code"]) && $res["return_code"] == "SUCCESS") {
|
|
|
+ if (isset($res["return_code"]) && $res["return_code"] == "SUCCESS" && isset($res["result_code"]) && $res["result_code"] == 'SUCCESS') {
|
|
|
$transactionId = $res['transaction_id'] ?? '';
|
|
|
$openId = $res['openid'] ?? '';
|
|
|
$payWay = dict::getDict('payWay', 'wxPay');
|
|
|
PurchaseService::codePay($payWay, $orderSn, $transactionId, $openId);
|
|
|
util::success(['returnStatus' => 'SUCCESS']);
|
|
|
}
|
|
|
+ util::complete('');
|
|
|
} catch (\Exception $e) {
|
|
|
Yii::info($e->getMessage());
|
|
|
util::fail('支付失败,请查询订单支付结果');
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
|
|
|
$aliF2F = Yii::getAlias("@vendor/alipayF2F");
|