切换到使用聚合时间轴后,似乎不再显示非用户帖子。
获取汇总时间轴的代码:
if (!empty($input['page'])) {
$feed0 = FeedManager::getNewsFeeds($user->id)['timeline_aggregated'];
$feed = $feed0->getActivities(0, 80, ["id_lt" => $page])['results'];
} else {
$feed0 = FeedManager::getNewsFeeds($user->id)['timeline_aggregated'];
$feed = $feed0->getActivities(0, 80)['results'];
}
以下代码是我关注公司的方式:
$feed = FeedManager::getClient()->feed('timeline', $user->id);
$feed->followFeed('company', $companyId);
以下代码是我添加公司活动的方式:
$a = [
"actor" => "App\Company:{$company->id}",
"verb" => "company_post",
"object" => "App\CompanyPost:{$post->id}",
"time" => $this->getTimeOfDubai(),
"foreign_id" => "App\CompanyPost:{$post->id}"
];
if ($company->sponsor_lock == 1) {
$companyFeed = FeedManager::getClient()->feed('sponsor', $company->id);
$a['sponsor_lock'] = 1;
} else {
$companyFeed = FeedManager::getClient()->feed('company', $company->id);
}
$companyFeed->addActivity($a);
如果我使用非聚合时间轴,所有这些都可以正常工作,但我的老板喜欢聚合时间线显示中的分组功能。我的代码中缺少什么?甚至在$ feed变量的var_dump中找不到动词。