-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
我这里用开发平台一直报 Credential "component_verify_ticket" does not exist in cache,redis连接正常,公众号直接配置时使用redis缓存也没有问题,但是使用开发平台授权就报这个错, 可以帮忙看下是哪里写的有问题嘛?
function third_party($url = '')
{
$options = Config('wechat.options');
if ($url) {
$options['oauth']['callback'] = $url;
}
$openPlatform = Factory::openPlatform($options);
$openPlatform['cache'] = getCacheApp();
$third_party_model = new ThirdPartyModel;
$condition['status'] = 1;
$res = $third_party_model->findThirdPartyInfo($condition);
$app = $openPlatform->officialAccount($res['authorizer_appid'], $res['authorizer_refresh_token']);
$app['cache'] = getCacheApp();
return $app;
}
function getCacheApp()
{
$redisConfig = config('redis');
if (empty($redisConfig['host']) || empty($redisConfig['port'])) {
throw new \think\Exception('请检查是否正确配置Redis');
}
$redis = new \Redis();
$res = $redis->connect($redisConfig['host'], $redisConfig['port']);
if ($res == false) {
abort("1" . $redis->getLastError());
}
$res = $redis->auth($redisConfig['password']);
if ($res == false) {
$redisError = $redis->getLastError();
if (substr_count($redisError, 'ERR Client sent AUTH, but no password is set')) {
// Redis 未设置密码
} else {
// 密码授权错误
abort("1" . $redis->getLastError());
}
}
$cacheDriver = new \Symfony\Component\Cache\Simple\RedisCache($redis);
return $cacheDriver;
}
Metadata
Metadata
Assignees
Labels
No labels