1557492053 1 year ago
parent
commit
224a279812

+ 5 - 4
application/api/service/TencentCloudService.php

@@ -9,10 +9,11 @@ use TencentCloud\Common\Profile\ClientProfile;
 use TencentCloud\Common\Profile\HttpProfile;
 use TencentCloud\Sms\V20210111\Models\SendSmsRequest;
 use TencentCloud\Sms\V20210111\SmsClient;
-
-// 导入 VMS 的 client
 use TencentCloud\Vms\V20200902\Models\SendTtsVoiceRequest;
 use TencentCloud\Vms\V20200902\VmsClient;
+use think\Env;
+
+// 导入 VMS 的 client
 
 class TencentCloudService extends BaseService
 {
@@ -23,8 +24,8 @@ class TencentCloudService extends BaseService
     {
         try {
             $cred = new Credential(
-                config("site.tencent_cloud_secret_id"),
-                config("site.tencent_cloud_secret_key")
+                Env::get("sms.tencent_cloud_secret_id"),
+                Env::get("sms.tencent_cloud_secret_key")
             );
             $httpProfile = new HttpProfile();
             $httpProfile->setReqMethod("GET");  // post请求(默认为post请求)

+ 11 - 10
application/api/service/WxService.php

@@ -4,6 +4,7 @@
 namespace app\api\service;
 
 
+use think\Env;
 use WeChatPay\Builder;
 use WeChatPay\Crypto\Rsa;
 use WeChatPay\Formatter;
@@ -15,33 +16,33 @@ class WxService extends BaseService
     private static function wxAppConfig()
     {
         return array_merge([
-            "appid" => config("site.wx_app_appid") ?? "",
-            "app_secret" => config("site.wx_app_secret") ?? "",
+            "appid" => Env::get("wxpay.wx_app_appid") ?? "",
+            "app_secret" => Env::get("wxpay.wx_app_secret") ?? "",
         ], WxService::wxMchConfig());
     }
 
     private static function wxWebConfig()
     {
         return array_merge([
-            "appid" => config("site.wx_h5_appid") ?? "",
-            "app_secret" => config("site.wx_h5_secret") ?? "",
+            "appid" => Env::get("wxpay.wx_h5_appid") ?? "",
+            "app_secret" => Env::get("wxpay.wx_h5_secret") ?? "",
         ], WxService::wxMchConfig());
     }
 
     private static function wxAppletConfig()
     {
         return array_merge([
-            "appid" => config("site.wx_applet_appid") ?? "",
-            "app_secret" => config("site.wx_applet_secret") ?? "",
+            "appid" => Env::get("wxpay.wx_applet_appid") ?? "",
+            "app_secret" => Env::get("wxpay.wx_applet_secret") ?? "",
         ], WxService::wxMchConfig());
     }
 
     private static function wxMchConfig()
     {
         return [
-            "mch_id" => config("site.wx_mch_id") ?? "",
-            "mch_v3_api" => config("site.wx_mch_v3_api") ?? "",
-            "mch_certificate_serial" => config("site.wx_mch_certificate_serial") ?? "",
+            "mch_id" => Env::get("wxpay.wx_mch_id") ?? "",
+            "mch_v3_api" => Env::get("wxpay.wx_mch_v3_api") ?? "",
+            "mch_certificate_serial" => Env::get("site.wx_mch_certificate_serial") ?? "",
             "mch_private_key_file_path" => ROOT_PATH . "certificate" . DS . "wx" . DS . "apiclient_key.pem",
             "platform_certificate_file_path" => ROOT_PATH . "certificate" . DS . "wx" . DS . "apiclient_cert.pem"
         ];
@@ -210,7 +211,7 @@ class WxService extends BaseService
                 'notify_url' => "https://pbbaby.xunsoftware.com/api.php/api/callback/wxrefund",
                 'amount' => [
                     'refund' => fixed2Float($refund_amount * 100),
-                    "total" => fixed2Float($total_amount * 100),
+                    'total' => fixed2Float($total_amount * 100),
                     'currency' => 'CNY'
                 ],
             ];