xieruidong 2 lat temu
rodzic
commit
eff0226dd2
1 zmienionych plików z 5 dodań i 5 usunięć
  1. 5 5
      application/service/WechatTransferSvc.php

+ 5 - 5
application/service/WechatTransferSvc.php

@@ -25,11 +25,11 @@ class WechatTransferSvc
         }
     }
 
-    public static function client(){
+    public function client(){
         static $client;
         if(!$client) {
-            $merchantId = config('pay.wechat.mch_id'); // 商户号
-            $merchantSerialNumber = config('pay.wechat.serial_no'); // 商户API证书序列号
+            $merchantId = $this->mchid; // 商户号
+            $merchantSerialNumber = $this->serial_no; // 商户API证书序列号
             $merchantPrivateKey = PemUtil::loadPrivateKey(self::filePath('key')); // 商户私钥文件路径
             $wechatpayCertificate = PemUtil::loadCertificate(self::filePath('platform.pem')); // 微信支付平台证书文件路径
             $wechatpayMiddleware = WechatPayMiddleware::builder()
@@ -66,7 +66,7 @@ class WechatTransferSvc
             'headers'=>[
                 'Accept'=>'application/json',
                 'Authorization'=>$this->token($url,$body),
-                'Wechatpay-Serial'=>config('pay.wechat.serial_no')
+                'Wechatpay-Serial'=>$this->serial_no
             ]
         ]);
         if($res->getStatusCode()!==200){
@@ -85,7 +85,7 @@ class WechatTransferSvc
                 'headers'=>[
                     'Accept'=>'application/json',
                     'Authorization'=>$this->token($url,''),
-                    'Wechatpay-Serial'=>config('pay.wechat.serial_no')
+                    'Wechatpay-Serial'=>$this->serial_no
                 ]
             ]);
         if($response->getStatusCode()!==200){