修改微信access_token
This commit is contained in:
@@ -5,11 +5,13 @@ namespace Extend\Wechat;
|
||||
use App\Constants\HttpEnumCode;
|
||||
use App\Exception\BusinessException;
|
||||
use App\Factory\CacheFactory;
|
||||
use App\Factory\ProdRedisFactory;
|
||||
use EasyWeChat\Kernel\Exceptions\BadResponseException;
|
||||
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
|
||||
use EasyWeChat\Kernel\HttpClient\AccessTokenAwareClient;
|
||||
use EasyWeChat\MiniApp\Application;
|
||||
use Hyperf\Cache\Cache;
|
||||
use Hyperf\Redis\Redis;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -85,7 +87,7 @@ class Wechat
|
||||
$this->app = new Application($config);
|
||||
|
||||
// 替换缓存
|
||||
$this->app->setCache(make(Cache::class,['driver' => 'prod']));
|
||||
$this->app->setCache(ApplicationContext::getContainer()->get(CacheFactory::class));
|
||||
|
||||
} catch (InvalidArgumentException $e) {
|
||||
throw new BusinessException('实例化EasyWeChat类失败:' . $e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
@@ -106,7 +108,6 @@ class Wechat
|
||||
$this->createApp($appId, $appSecret);
|
||||
|
||||
return $this->app->getClient();
|
||||
|
||||
} catch (NotFoundExceptionInterface|ContainerExceptionInterface $e) {
|
||||
throw new BusinessException('实例化EasyWeChat类失败:' . $e->getMessage(), HttpEnumCode::SERVER_ERROR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user