diff --git a/WeChat/Script.php b/WeChat/Script.php index 0a54b6b..c04be36 100644 --- a/WeChat/Script.php +++ b/WeChat/Script.php @@ -60,7 +60,7 @@ class Script extends BasicWeChat throw new InvalidResponseException('Invalid Resoponse Ticket.', '0'); } $ticket = $result['ticket']; - Tools::setCache($cache_name, $ticket, 5000); + Tools::setCache($cache_name, $ticket, 7000); } return $ticket; } diff --git a/WePayV3/Order.php b/WePayV3/Order.php index 460c995..355e2a7 100644 --- a/WePayV3/Order.php +++ b/WePayV3/Order.php @@ -60,10 +60,10 @@ class Order extends BasicWePay $prepayId = $result['prepay_id']; $nonceStr = Tools::createNoncestr(); if ($type === 'app') { - $sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $prepayId])."\n"); + $sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $prepayId, ''])); return ['partnerId' => $this->config['mch_id'], 'prepayId' => $prepayId, 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign]; } elseif ($type === 'jsapi') { - $sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$prepayId}"])."\n"); + $sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$prepayId}", ''])); return ['appId' => $appid, 'timeStamp' => $time, 'nonceStr' => $nonceStr, 'package' => "prepay_id={$prepayId}", 'signType' => 'RSA', 'paySign' => $sign]; } else { return $result; diff --git a/_test/pay-v3-order-create.php b/_test/pay-v3-order-create.php index db80007..5448b6a 100644 --- a/_test/pay-v3-order-create.php +++ b/_test/pay-v3-order-create.php @@ -14,10 +14,10 @@ try { 'appid' => 'wx60a43dd8161666d4', 'mchid' => $config['mch_id'], 'description' => '商品描述', - 'out_trade_no' => date("YmdHis"), + 'out_trade_no' => (string)time(), 'notify_url' => 'https://thinkadmin.top', 'payer' => ['openid' => 'o38gps3vNdCqaggFfrBRCRikwlWY'], - 'amount' => ['total' => 1, 'currency' => 'CNY'], + 'amount' => ['total' => 2, 'currency' => 'CNY'], ]); echo '
';