Authored by whb

Merge branch 'temp'

... ... @@ -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;
/**
... ... @@ -403,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;
}
/**
* 检查微信扫码支付结果
*
... ... @@ -462,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);
$result = WxPayApi::orderQuery($input);
if ($orderInfo['data']['payment_status'] === 'Y') {
if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
$result = array(
'code' => '200',
'message' => 'success'
... ...