...
|
...
|
@@ -9,8 +9,10 @@ use WebPlugin\Pay\Banks; |
|
|
use WebPlugin\Pay\PayFactory;
|
|
|
use WebPlugin\Pay\Reqparams;
|
|
|
use WebPlugin\Pay\Rspparams;
|
|
|
use WebPlugin\Pay\weixin\lib\WxPayApi;
|
|
|
use WebPlugin\Pay\weixin\lib\WxPayConfig;
|
|
|
use WebPlugin\Pay\weixin\lib\WxPayNativePay;
|
|
|
use WebPlugin\Pay\weixin\lib\WxPayOrderQuery;
|
|
|
use WebPlugin\Pay\weixin\lib\WxPayUnifiedOrder;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -342,10 +344,9 @@ class PayModel |
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $orderCode 订单号
|
|
|
* @param int $paymentCode 支付方式ID
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function weixinQrcode($uid, $orderCode, $paymentCode)
|
|
|
public static function weixinQrcode($uid, $orderCode)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
...
|
...
|
@@ -404,46 +405,6 @@ class PayModel |
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 处理支付结果数据
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $orderCode 订单号
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getPayDetail($uid, $orderCode)
|
|
|
{
|
|
|
$result = array(
|
|
|
'code' => 500,
|
|
|
'message' => '支付失败'
|
|
|
);
|
|
|
|
|
|
do {
|
|
|
$orderInfo = OrderData::getOrderDetail($uid, $orderCode);
|
|
|
if (!isset($orderInfo['data']['payment_status']) || $orderInfo['data']['payment_status'] !== 'Y') {
|
|
|
break;
|
|
|
}
|
|
|
$result['code'] = 200;
|
|
|
$result['message'] = '支付成功,请等待发货';
|
|
|
$orderData = $orderInfo['data'];
|
|
|
$result['data'] = array(
|
|
|
'pay' => $orderData['payment_amount'],
|
|
|
'orderNum' => $orderData['order_code'],
|
|
|
'checkOrderUrl' => Helpers::url('/home/orders/detail', array('order_code' => $orderData['order_code'])),
|
|
|
'payMode' => ($orderData['payment_type'] == 1 ? '在线支付' : '货到付款'),
|
|
|
'currency' => $orderData['yoho_give_coin'],
|
|
|
'yohoCoinUrl' => Helpers::url('/help', array('category_id' => 87)),
|
|
|
'vipSum' => $orderData['order_code'],
|
|
|
'returnGoodsUrl' => Helpers::url('/help', array('category_id' => 121)),
|
|
|
'vipUrl' => Helpers::url('/help', array('category_id' => 91)),
|
|
|
'returnHomeUrl' => Helpers::url('/')
|
|
|
);
|
|
|
} while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 检查微信扫码支付结果
|
|
|
*
|
...
|
...
|
@@ -463,12 +424,13 @@ class PayModel |
|
|
break;
|
|
|
}
|
|
|
|
|
|
$orderInfo = OrderData::getOrderDetail($uid, $orderCode);
|
|
|
if (!isset($orderInfo['data']) || empty($orderInfo['data'])) {
|
|
|
break;
|
|
|
}
|
|
|
// 组装微信支付的订单号
|
|
|
$tradeNo = 'YOHOBuy_' . $orderCode;
|
|
|
$input = new WxPayOrderQuery();
|
|
|
$input->SetOut_trade_no($tradeNo);
|
|
|
$payResult = WxPayApi::orderQuery($input);
|
|
|
|
|
|
if ($orderInfo['data']['payment_status'] === 'Y') {
|
|
|
if (isset($payResult['trade_state']) && $payResult['trade_state'] === 'SUCCESS') {
|
|
|
$result = array(
|
|
|
'code' => '200',
|
|
|
'message' => 'success'
|
...
|
...
|
|