|
|
@ -31,7 +31,9 @@ use App\Service\v3\Interfaces\TabsServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserCenterBlockServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserCenterBlockServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserInfoServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserInfoServiceInterface; |
|
|
use App\TaskWorker\SSDBTask; |
|
|
use App\TaskWorker\SSDBTask; |
|
|
|
|
|
use EasyWeChat\Factory; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
|
|
use Hyperf\Guzzle\CoroutineHandler; |
|
|
use Hyperf\Redis\Redis; |
|
|
use Hyperf\Redis\Redis; |
|
|
use Hyperf\Utils\ApplicationContext; |
|
|
use Hyperf\Utils\ApplicationContext; |
|
|
use Psr\Http\Message\ResponseInterface; |
|
|
use Psr\Http\Message\ResponseInterface; |
|
|
@ -206,6 +208,21 @@ class HomeController extends BaseController |
|
|
|
|
|
|
|
|
$data['block'] = $this->userCenterBlockService->all($roles); |
|
|
$data['block'] = $this->userCenterBlockService->all($roles); |
|
|
|
|
|
|
|
|
|
|
|
// 返回用户是否已经关注公众号和查看时候跳转的文章地址
|
|
|
|
|
|
$app = Factory::officialAccount(config('wechat.official')); |
|
|
|
|
|
$app['guzzle_handler'] = CoroutineHandler::class; |
|
|
|
|
|
$fansInfo = $app->user->get($data['user']['openid']); |
|
|
|
|
|
|
|
|
|
|
|
$redis = ApplicationContext::getContainer()->get(Redis::class); |
|
|
|
|
|
if ($fansInfo['subscribe'] == 1) { |
|
|
|
|
|
$subscribeInfo = $redis->hGet('official:subscribe_info', 'subscribed'); |
|
|
|
|
|
} else { |
|
|
|
|
|
$subscribeInfo = $redis->hGet('official:subscribe_info', 'not_subscribed'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$subscribeInfo = !empty($subscribeInfo) ? json_decode($subscribeInfo, true) : []; |
|
|
|
|
|
$data['subscribe_info'] = array_merge($fansInfo, $subscribeInfo); |
|
|
|
|
|
|
|
|
return $this->success($data); |
|
|
return $this->success($data); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|