|
|
|
@ -24,6 +24,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
|
|
|
|
use App\Services\StatusHashtagService;
|
|
|
|
|
use App\Services\SnowflakeService;
|
|
|
|
|
use App\Services\StatusService;
|
|
|
|
|
use App\Services\UserFilterService;
|
|
|
|
|
|
|
|
|
|
class DiscoverController extends Controller
|
|
|
|
|
{
|
|
|
|
@ -149,16 +150,35 @@ class DiscoverController extends Controller
|
|
|
|
|
->pluck('id');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$filtered = Auth::check() ? UserFilterService::filters(Auth::user()->profile_id) : [];
|
|
|
|
|
|
|
|
|
|
$res = $ids->map(function($s) {
|
|
|
|
|
return StatusService::get($s);
|
|
|
|
|
});
|
|
|
|
|
})->filter(function($s) use($filtered) {
|
|
|
|
|
return $s && !in_array($s['account']['id'], $filtered);
|
|
|
|
|
})->values();
|
|
|
|
|
|
|
|
|
|
return response()->json($res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function trendingHashtags(Request $request)
|
|
|
|
|
{
|
|
|
|
|
return [];
|
|
|
|
|
$res = StatusHashtag::select('hashtag_id', \DB::raw('count(*) as total'))
|
|
|
|
|
->groupBy('hashtag_id')
|
|
|
|
|
->orderBy('total','desc')
|
|
|
|
|
->where('created_at', '>', now()->subDays(90))
|
|
|
|
|
->take(9)
|
|
|
|
|
->get()
|
|
|
|
|
->map(function($h) {
|
|
|
|
|
$hashtag = $h->hashtag;
|
|
|
|
|
return [
|
|
|
|
|
'id' => $hashtag->id,
|
|
|
|
|
'total' => $h->total,
|
|
|
|
|
'name' => '#'.$hashtag->name,
|
|
|
|
|
'url' => $hashtag->url('?src=dsh1')
|
|
|
|
|
];
|
|
|
|
|
});
|
|
|
|
|
return $res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function trendingPlaces(Request $request)
|
|
|
|
|