|
@@ -15,7 +15,7 @@ use App\{
|
|
StatusView,
|
|
StatusView,
|
|
UserFilter
|
|
UserFilter
|
|
};
|
|
};
|
|
-use Auth,Cache;
|
|
|
|
|
|
+use Auth, Cache;
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
use League\Fractal;
|
|
use League\Fractal;
|
|
use App\Transformer\Api\{
|
|
use App\Transformer\Api\{
|
|
@@ -27,6 +27,8 @@ use App\Transformer\Api\{
|
|
use App\Services\{
|
|
use App\Services\{
|
|
AccountService,
|
|
AccountService,
|
|
PublicTimelineService,
|
|
PublicTimelineService,
|
|
|
|
+ StatusService,
|
|
|
|
+ SnowflakeService,
|
|
UserFilterService
|
|
UserFilterService
|
|
};
|
|
};
|
|
use App\Jobs\StatusPipeline\NewStatusPipeline;
|
|
use App\Jobs\StatusPipeline\NewStatusPipeline;
|
|
@@ -498,6 +500,7 @@ class PublicApiController extends Controller
|
|
$max = $request->input('max_id');
|
|
$max = $request->input('max_id');
|
|
$limit = $request->input('limit') ?? 3;
|
|
$limit = $request->input('limit') ?? 3;
|
|
$user = $request->user();
|
|
$user = $request->user();
|
|
|
|
+ $amin = SnowflakeService::byDate(now()->subDays(90));
|
|
|
|
|
|
$key = 'user:last_active_at:id:'.$user->id;
|
|
$key = 'user:last_active_at:id:'.$user->id;
|
|
$ttl = now()->addMinutes(5);
|
|
$ttl = now()->addMinutes(5);
|
|
@@ -513,61 +516,41 @@ class PublicApiController extends Controller
|
|
$timeline = Status::select(
|
|
$timeline = Status::select(
|
|
'id',
|
|
'id',
|
|
'uri',
|
|
'uri',
|
|
- 'caption',
|
|
|
|
- 'rendered',
|
|
|
|
- 'profile_id',
|
|
|
|
'type',
|
|
'type',
|
|
- 'in_reply_to_id',
|
|
|
|
- 'reblog_of_id',
|
|
|
|
- 'is_nsfw',
|
|
|
|
'scope',
|
|
'scope',
|
|
- 'local',
|
|
|
|
- 'reply_count',
|
|
|
|
- 'comments_disabled',
|
|
|
|
- 'place_id',
|
|
|
|
- 'likes_count',
|
|
|
|
- 'reblogs_count',
|
|
|
|
'created_at',
|
|
'created_at',
|
|
- 'updated_at'
|
|
|
|
)->where('id', $dir, $id)
|
|
)->where('id', $dir, $id)
|
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
|
->whereNotNull('uri')
|
|
->whereNotNull('uri')
|
|
->whereScope('public')
|
|
->whereScope('public')
|
|
- ->where('created_at', '>', now()->subMonths(3))
|
|
|
|
|
|
+ ->where('id', '>', $amin)
|
|
->orderBy('created_at', 'desc')
|
|
->orderBy('created_at', 'desc')
|
|
->limit($limit)
|
|
->limit($limit)
|
|
- ->get();
|
|
|
|
|
|
+ ->get()
|
|
|
|
+ ->map(function($s) {
|
|
|
|
+ return StatusService::get($s->id);
|
|
|
|
+ });
|
|
|
|
+ $res = $timeline->toArray();
|
|
} else {
|
|
} else {
|
|
- $timeline = Status::select(
|
|
|
|
- 'id',
|
|
|
|
- 'uri',
|
|
|
|
- 'caption',
|
|
|
|
- 'rendered',
|
|
|
|
- 'profile_id',
|
|
|
|
- 'type',
|
|
|
|
- 'in_reply_to_id',
|
|
|
|
- 'reblog_of_id',
|
|
|
|
- 'is_nsfw',
|
|
|
|
- 'scope',
|
|
|
|
- 'local',
|
|
|
|
- 'reply_count',
|
|
|
|
- 'comments_disabled',
|
|
|
|
- 'created_at',
|
|
|
|
- 'place_id',
|
|
|
|
- 'likes_count',
|
|
|
|
- 'reblogs_count',
|
|
|
|
- 'updated_at'
|
|
|
|
- )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
|
|
|
- ->with('profile', 'hashtags', 'mentions')
|
|
|
|
- ->whereNotNull('uri')
|
|
|
|
- ->whereScope('public')
|
|
|
|
- ->where('created_at', '>', now()->subMonths(3))
|
|
|
|
- ->orderBy('created_at', 'desc')
|
|
|
|
- ->simplePaginate($limit);
|
|
|
|
|
|
+ $timeline = Status::select(
|
|
|
|
+ 'id',
|
|
|
|
+ 'uri',
|
|
|
|
+ 'type',
|
|
|
|
+ 'scope',
|
|
|
|
+ 'created_at',
|
|
|
|
+ )->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
|
|
|
+ ->whereNotNull('uri')
|
|
|
|
+ ->whereScope('public')
|
|
|
|
+ ->where('id', '>', $amin)
|
|
|
|
+ ->orderBy('created_at', 'desc')
|
|
|
|
+ ->limit($limit)
|
|
|
|
+ ->get()
|
|
|
|
+ ->map(function($s) {
|
|
|
|
+ return StatusService::get($s->id);
|
|
|
|
+ });
|
|
|
|
+ $res = $timeline->toArray();
|
|
}
|
|
}
|
|
|
|
|
|
- $fractal = new Fractal\Resource\Collection($timeline, new StatusTransformer());
|
|
|
|
- $res = $this->fractal->createData($fractal)->toArray();
|
|
|
|
return response()->json($res);
|
|
return response()->json($res);
|
|
}
|
|
}
|
|
|
|
|