123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Service\WechatPlatform;
- use EasyWeChat\Factory;
- use EasyWeChat\OpenPlatform\Application;
- use Illuminate\Support\Facades\Cache;
- class WechatPlatform
- {
- public static function buildApplication($componentInfo) {
- $config = [
- 'app_id' => $componentInfo->app_id,
- 'secret' => $componentInfo->secret,
- 'token' => $componentInfo->token,
- 'aes_key' => $componentInfo->aes_key,
- ];
- $app = Factory::openPlatform(array_merge($config, config('easywechat')));
- $app->rebind('cache',Cache::store('redis'));
- return $app;
- }
-
- public static function officialAccount($app, $appid, $refreshToken) {
- return $app->officialAccount($appid, $refreshToken);
- }
- }
|