Authored by 毕凯

Merge branch 'hotfix/payLaftTime'

... ... @@ -42,8 +42,6 @@ class Service extends PayAbstract
public function getPayRequestPars(Reqparams $params)
{
// $baseUrl = $this->getBaseNoticeUrl($params->isTest);
// $loseTime = intval(($params->orderTime + 7200 - time()) / 60);
// $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60);
UdpLog::info("【{$this->logProjectPrefix}-支付宝银行支付】,function:getPayRequestPars,参数", $params);
$parameter = array(
'service' => $this->config->service,
... ... @@ -58,7 +56,7 @@ class Service extends PayAbstract
'payment_type' => $this->config->payment_type,
'defaultbank' => $params->paymentParameter,
'seller_email' => $this->config->sellerMail,
// 'it_b_pay' => $loseTime . 'm'
'it_b_pay' => $params->payExpireMinute . 'm',
);
if ($this->config->anti_fishing['timestamp_enable']) {
$anti_phishing_key = $this->getTimestamp();
... ...
... ... @@ -47,8 +47,6 @@ class Service extends PayAbstract
{
UdpLog::info("【{$this->logProjectPrefix}-支付宝支付】,function:getPayRequestPars,参数", $params);
// $baseUrl = $this->getBaseNoticeUrl($params->isTest);
// $loseTime = intval(($params->orderTime + 7200 -time())/60);
// $loseTime = intval((strtotime(date("Y-m-d 10:00:00", strtotime("+1 day")))-time())/60); //第二天十点
$parameter = array(
'service' => $this->config->service,
'partner' => $this->config->partner,
... ... @@ -58,13 +56,14 @@ class Service extends PayAbstract
/* 业务参数 */
'subject' => $params->goodsName,
'out_trade_no' => $params->orderCode,
// 'it_b_pay' => $loseTime . 'm',
'it_b_pay' => $params->payExpireMinute . 'm',
'total_fee' => $params->totalFee / 100, //单位为元
'payment_type' => $this->config->payment_type,
'seller_email' => $this->config->sellerMail,
'sign_id_ext' => $params->uid,
'sign_name_ext' => $params->userName
);
if ($this->config->anti_fishing['timestamp_enable']) {
$anti_phishing_key = $this->getTimestamp();
if (!empty($anti_phishing_key)) {
... ...
... ... @@ -11,17 +11,25 @@ namespace WebPlugin\Pay;
class Reqparams
{
public function __construct($_orderCode, $_totalFee, $_goodName, $client_ip, $_orderTime, $_paymentParameter="", $_isTest=false, $uid=0, $userName='')
public function __construct($_orderCode, $_totalFee, $_goodName, $client_ip, $_orderTime, $_paymentParameter="", $_isTest=false, $uid=0, $userName='', $_payExpire = '')
{
$this->orderCode = $_orderCode;
$this->totalFee = $_totalFee;
$this->goodsName = $_goodName;
$this->spbill_create_ip = $client_ip;
$this->orderTime = $_orderTime;
$this->paymentParameter = $_paymentParameter;
$this->isTest = $_isTest;
$this->uid = $uid;
$this->userName = $userName;
//到期时间,默认为当前时间加2个小时的时间戳
$_payExpire = empty($_payExpire) ? strtotime('+2 hours') : strtotime($_payExpire);
$payExpireMinute = 0;//剩余分钟数
if ($_payExpire && ($expireTime = $_payExpire - time()) > 0) {
$payExpireMinute = floor($expireTime / 60);
}
$this->orderCode = $_orderCode;
$this->totalFee = $_totalFee;
$this->goodsName = $_goodName;
$this->spbill_create_ip = $client_ip;
$this->orderTime = $_orderTime;
$this->payExpireMinute = $payExpireMinute;
$this->paymentParameter = $_paymentParameter;
$this->isTest = $_isTest;
$this->uid = $uid;
$this->userName = $userName;
}
/**
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -283,7 +283,10 @@ class PayModel
$paymentParameter = $alipayToken;
}
$reqParams = new Reqparams($orderCode, $totalFee, '有货订单号:' . $orderCode, '', $orderDetail['data']['create_time'], $paymentParameter, $isTest, $uid, $userName);
$reqParams = new Reqparams(
$orderCode, $totalFee, '有货订单号:' . $orderCode, '', $orderDetail['data']['create_time'],
$paymentParameter, $isTest, $uid, $userName, $orderDetail['data']['pay_expire']
);
$reqPars = $payService->getPayRequestPars($reqParams);
if (empty($reqPars)) {
$result['error'] = true;
... ...
... ... @@ -325,14 +325,28 @@ class PaymentModel
$input->SetBody('有货订单号:' . $orderCode);
$input->SetOut_trade_no('YOHOBuy_' . $orderCode); // 商户订单号
$input->SetTotal_fee($totalFee);
$input->SetTime_start(date("YmdHis"));
$input->SetTime_expire(date("YmdHis", time() + 600));
//到期时间
if (!empty($orderDetail['data']['pay_expire']) && ($payExpireTime = strtotime($orderDetail['data']['pay_expire']))) {
$payExpireTime = $payExpireTime;
} else {
$payExpireTime = time();
}
$input->SetTime_start(date("YmdHis", strtotime('-2 hours', $payExpireTime)));
//最短失效时间间隔必须大于5分钟 [https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_1]
$input->SetTime_expire(date("YmdHis", $payExpireTime + 300));
$input->SetTrade_type("NATIVE");
$input->SetProduct_id($orderCode);
$notify = new WxPayNativePay();
$payResult = $notify->GetPayUrl($input);
//错误信息,EQ:超时
if (!empty($payResult['return_code']) && $payResult['return_code'] === 'FAIL') {
self::$code['message'] = $payResult['return_msg'];
break;
}
if ($payResult['result_code'] === 'FAIL') {
//错误信息,EQ:多次涮新
if (!empty($payResult['result_code']) && $payResult['result_code'] === 'FAIL') {
self::$code['message'] = $payResult['err_code_des'];
break;
}
... ... @@ -522,7 +536,10 @@ class PaymentModel
$paymentParameter = $alipayToken;
}
$reqParams = new Reqparams($orderCode, $totalFee, '有货订单号:' . $orderCode, '', $orderDetail['data']['create_time'], $paymentParameter, $isTest, $uid, $userName);
$reqParams = new Reqparams(
$orderCode, $totalFee, '有货订单号:' . $orderCode, '', $orderDetail['data']['create_time'],
$paymentParameter, $isTest, $uid, $userName, $orderDetail['data']['pay_expire']
);
$reqPars = $payService->getPayRequestPars($reqParams);
UdpLog::info(
"【支付-参数】,function:getPayData,orderCode:{$orderCode},接口返回",
... ...