diff --git a/WePayV3/Order.php b/WePayV3/Order.php index 489f386..0ad4284 100644 --- a/WePayV3/Order.php +++ b/WePayV3/Order.php @@ -64,14 +64,13 @@ class Order extends BasicWePay // 支付参数签名 $time = strval(time()); $appid = $this->config['appid']; - $prepayId = $result['prepay_id']; $nonceStr = Tools::createNoncestr(); if ($type === 'app') { - $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]; + $sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $result['prepay_id'], ''])); + return ['partnerId' => $this->config['mch_id'], 'prepayId' => $result['prepay_id'], 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign]; } elseif ($type === 'jsapi') { - $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]; + $sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$result['prepay_id']}", ''])); + return ['appId' => $appid, 'timeStamp' => $time, 'nonceStr' => $nonceStr, 'package' => "prepay_id={$result['prepay_id']}", 'signType' => 'RSA', 'paySign' => $sign]; } else { return $result; }