Authored by 郝肖肖

微信 支付加到期时间

... ... @@ -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;
}
... ...