Skip to content

Commit c617666

Browse files
committed
fix: 支付类型判定使用常量
1 parent 7b291e3 commit c617666

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

WePayV3/Ecommerce.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,10 @@ public function getJsApiParameters($prepay_id, $type = 'jsapi')
763763
$time = strval(time());
764764
$appid = $this->config['appid'];
765765
$nonceStr = Tools::createNoncestr();
766-
if ($type === 'app') {
766+
if ($type === Order::WXPAY_APP) {
767767
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $prepay_id, '']));
768768
return ['partnerId' => $this->config['mch_id'], 'prepayId' => $prepay_id, 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign];
769-
} elseif ($type === 'jsapi') {
769+
} elseif ($type === Order::WXPAY_JSAPI) {
770770
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$prepay_id}", '']));
771771
return ['appId' => $appid, 'timestamp' => $time, 'timeStamp' => $time, 'nonceStr' => $nonceStr, 'package' => "prepay_id={$prepay_id}", 'signType' => 'RSA', 'paySign' => $sign];
772772
} else {

WePayV3/Order.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ public function create($type, $data)
6464
$time = strval(time());
6565
$appid = $this->config['appid'];
6666
$nonceStr = Tools::createNoncestr();
67-
if ($type === 'app') {
67+
if ($type === self::WXPAY_APP) {
6868
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, $result['prepay_id'], '']));
6969
return ['partnerId' => $this->config['mch_id'], 'prepayId' => $result['prepay_id'], 'package' => 'Sign=WXPay', 'nonceStr' => $nonceStr, 'timeStamp' => $time, 'sign' => $sign];
70-
} elseif ($type === 'jsapi') {
70+
} elseif ($type === self::WXPAY_JSAPI) {
7171
$sign = $this->signBuild(join("\n", [$appid, $time, $nonceStr, "prepay_id={$result['prepay_id']}", '']));
7272
return ['appId' => $appid, 'timestamp' => $time, 'timeStamp' => $time, 'nonceStr' => $nonceStr, 'package' => "prepay_id={$result['prepay_id']}", 'signType' => 'RSA', 'paySign' => $sign];
7373
} else {

0 commit comments

Comments
 (0)