Jelajahi Sumber

easywechat 日志配置

liuzejian 1 tahun lalu
induk
melakukan
b88c30ea4a

+ 23 - 0
config/easywechat.php

@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * easywechat 5.0 公共配置
+ */
+return [
+    'response_type' => 'array',
+    'http' => [
+        'throw'  => true, // 状态码非 200、300 时是否抛出异常,默认为开启
+        'timeout' => 5.0,
+        'retry' => true, // 使用默认重试配置
+    ],
+    'log' => [
+        'default' => 'prod',
+        'channels' => [
+            'prod' => [
+                'driver' => 'daily',
+                'path' => storage_path('logs/easyWechat.log'),
+                'level' => env('EASY_WECHAT_LOG_LEVEL', 'debug'),
+            ]
+        ]
+    ]
+];

+ 1 - 6
modules/Channel/Services/WechatOpenPlatform/WechatOpenPlatformService.php

@@ -51,13 +51,8 @@ class WechatOpenPlatformService
             'secret' => $componentInfo->secret,   // 开放平台账号的 secret
             'secret' => $componentInfo->secret,   // 开放平台账号的 secret
             'token' => $componentInfo->token,  // 开放平台账号的 token
             'token' => $componentInfo->token,  // 开放平台账号的 token
             'aes_key' => $componentInfo->aes_key,   // 明文模式请勿填写 EncodingAESKey
             'aes_key' => $componentInfo->aes_key,   // 明文模式请勿填写 EncodingAESKey
-            'response_type' => 'array',
-            'http' => [
-                'throw'  => true, // 状态码非 200、300 时是否抛出异常,默认为开启
-                'timeout' => 5.0,
-                'retry' => true, // 使用默认重试配置
-            ],
         ];
         ];
+        $config  = array_merge($config, config('easywechat'));
         $app = Factory::openPlatform($config);
         $app = Factory::openPlatform($config);
         $app->rebind('cache', Cache::store('redis'));
         $app->rebind('cache', Cache::store('redis'));
         return $app;
         return $app;