From f16094dcae2b5ba9b9a8f4d4c1bed6285e4584c6 Mon Sep 17 00:00:00 2001
From: mkm <727897186@qq.com>
Date: Mon, 6 May 2024 19:00:07 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/common/logic/PaymentLogic.php | 30 +++++++++++-------------------
 config/payment.php                |  4 ++--
 2 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/app/common/logic/PaymentLogic.php b/app/common/logic/PaymentLogic.php
index 76b0e8e..bfa3020 100644
--- a/app/common/logic/PaymentLogic.php
+++ b/app/common/logic/PaymentLogic.php
@@ -20,6 +20,9 @@ use app\common\service\pay\WeChatPayService;
 use Webman\Config;
 use Yansongda\Pay\Pay;
 use app\common\model\user\UserAuth;
+use GuzzleHttp\Command\Guzzle\GuzzleClient;
+use Symfony\Component\HttpClient\HttpClient;
+use Yansongda\Artful\Contract\HttpClientInterface;
 
 /**
  * 支付逻辑
@@ -28,18 +31,7 @@ use app\common\model\user\UserAuth;
  */
 class PaymentLogic extends BaseLogic
 {
-    /**
-     * 授权信息
-     * @var UserAuth|array|\think\Model
-     */
-    protected $auth;
 
-    public function __construct()
-    {
-        $config = Config::get('payment');
-        Pay::config($config);
-
-    }
     /**
      * @notes 支付
      * @param $payWay
@@ -80,11 +72,12 @@ class PaymentLogic extends BaseLogic
                         'currency' => 'CNY',
                     ],
                     "payer" => [
-                        "openid" => $auth['openid']??0
+                        "openid" => $auth['openid'] ?? 0
                     ],
                     'attach' => $from
                 ];
-                
+                $config = Config::get('payment');
+                Pay::config($config);
                 $result = Pay::wechat()->mini($order);
                 break;
             default:
@@ -92,10 +85,10 @@ class PaymentLogic extends BaseLogic
                 $result = false;
         }
 
-        if (false === $result && !self::hasError()) {
-            d($payService->getError());
-            self::setError($payService->getError());
-        }
+        // if (false === $result && !self::hasError()) {
+        //     d($payService->getError());
+        //     self::setError($payService->getError());
+        // }
         return $result;
     }
 
@@ -116,5 +109,4 @@ class PaymentLogic extends BaseLogic
         $suffix = mb_substr(time(), -4);
         return $orderSn . $terminal . $suffix;
     }
-
-}
\ No newline at end of file
+}
diff --git a/config/payment.php b/config/payment.php
index 7f21c15..bb647a5 100644
--- a/config/payment.php
+++ b/config/payment.php
@@ -34,9 +34,9 @@ return [
             // 必填-商户秘钥
             'mch_secret_key' => 'F6C2A57790C667607D8E8C0C00CCF9B6',
             // 必填-商户私钥 字符串或路径
-            'mch_secret_cert' => getenv(runtime_path('/cart/c208f16ad08e6d2516e0b73e6d0ab8da.pem')),
+            'mch_secret_cert' => runtime_path().'/cert/c208f16ad08e6d2516e0b73e6d0ab8da.pem',
             // 必填-商户公钥证书路径
-            'mch_public_cert_path' =>getenv(runtime_path('/cart/82fdc3426e3aeb9e5df91a9547ac5ef3.pem')),
+            'mch_public_cert_path' =>runtime_path().'/cert/82fdc3426e3aeb9e5df91a9547ac5ef3.pem',
             // 必填
             'notify_url' => 'https://erp.lihaink.cn/api/pay/notifyMnp',
             // 选填-公众号 的 app_id