From 487ad85b3882520ee64469e6a95a8823fdc081af Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 17 Jul 2019 11:35:07 +0800 Subject: [PATCH] Update WechatService.php --- application/wechat/service/WechatService.php | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/application/wechat/service/WechatService.php b/application/wechat/service/WechatService.php index cc0f912df..37972eeb7 100644 --- a/application/wechat/service/WechatService.php +++ b/application/wechat/service/WechatService.php @@ -130,17 +130,18 @@ class WechatService extends \We } else { throw new \think\Exception("Class {$class} not found"); } - } - set_time_limit(3600); - list($appid, $appkey) = [sysconf('wechat_thr_appid'), sysconf('wechat_thr_appkey')]; - $token = strtolower("{$name}-{$appid}-{$appkey}-{$type}"); - if (class_exists('Yar_Client')) { - return new \Yar_Client(config('wechat.service_url') . "/service/api.client/yar/{$token}"); - } elseif (class_exists('SoapClient')) { - $location = config('wechat.service_url') . "/service/api.client/soap/{$token}"; - return new \SoapClient(null, ['uri' => strtolower($name), 'location' => $location]); } else { - throw new \think\Exception("Yar or Soap extensions are not installed."); + set_time_limit(3600); + list($appid, $appkey) = [sysconf('wechat_thr_appid'), sysconf('wechat_thr_appkey')]; + $token = strtolower("{$name}-{$appid}-{$appkey}-{$type}"); + if (class_exists('Yar_Client')) { + return new \Yar_Client(config('wechat.service_url') . "/service/api.client/yar/{$token}"); + } elseif (class_exists('SoapClient')) { + $location = config('wechat.service_url') . "/service/api.client/soap/{$token}"; + return new \SoapClient(null, ['uri' => strtolower($name), 'location' => $location]); + } else { + throw new \think\Exception("Yar or Soap extensions are not installed."); + } } }