|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Service\WechatPlatform;
|
|
|
|
|
|
+use EasyWeChat\Factory;
|
|
|
use EasyWeChat\OpenPlatform\Application;
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
|
@@ -13,14 +14,10 @@ class WechatPlatform
|
|
|
'secret' => $componentInfo->secret, // 开放平台账号的 secret
|
|
|
'token' => $componentInfo->token, // 开放平台账号的 token
|
|
|
'aes_key' => $componentInfo->aes_key, // 明文模式请勿填写 EncodingAESKey
|
|
|
- 'http' => [
|
|
|
- 'throw' => true, // 状态码非 200、300 时是否抛出异常,默认为开启
|
|
|
- 'timeout' => 5.0,
|
|
|
- 'retry' => true, // 使用默认重试配置
|
|
|
- ],
|
|
|
];
|
|
|
- $app = new Application($config);
|
|
|
- $app->setCache(Cache::store('redis'));
|
|
|
+
|
|
|
+ $app = Factory::openPlatform(array_merge($config, config('easywechat')));
|
|
|
+ $app->rebind('cache',Cache::store('redis'));
|
|
|
return $app;
|
|
|
}
|
|
|
|
|
@@ -31,7 +28,6 @@ class WechatPlatform
|
|
|
* @return \EasyWeChat\OfficialAccount\Application
|
|
|
*/
|
|
|
public static function officialAccount($app, $appid, $refreshToken) {
|
|
|
-
|
|
|
- return $app->getOfficialAccountWithRefreshToken($appid, $refreshToken);
|
|
|
+ return $app->officialAccount($appid, $refreshToken);
|
|
|
}
|
|
|
}
|