mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
asdf
This commit is contained in:
parent
b15b804999
commit
0655511574
6 changed files with 22 additions and 13 deletions
|
@ -40,8 +40,6 @@
|
|||
'created_at' => $user->created_at,
|
||||
'updated_at' => $user->updated_at,
|
||||
'slug' => $user->slug,
|
||||
'password_hash' => $user->password_hash,
|
||||
'password_salt' => $user->password_salt,
|
||||
'bio' => $user->bio,
|
||||
'sync_names' => $user->sync_names,
|
||||
'can_see_explicit_content' => $user->can_see_explicit_content,
|
||||
|
|
|
@ -67,13 +67,13 @@
|
|||
|
||||
$user = new User;
|
||||
|
||||
$user->username = $poniverseUser['username'];
|
||||
$user->mlpforums_name = $poniverseUser['username'];
|
||||
$user->display_name = $poniverseUser['display_name'];
|
||||
$user->email = $poniverseUser['email'];
|
||||
$user->created_at = gmdate("Y-m-d H:i:s", time());
|
||||
$user->uses_gravatar = 1;
|
||||
|
||||
$user->save();
|
||||
$user->roles()->attach(4);
|
||||
|
||||
//We need to insert a new token row :O
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@ class CreateUsersTable extends Migration {
|
|||
$table->string('display_name', 255);
|
||||
$table->string('mlpforums_name')->nullable();
|
||||
$table->boolean('sync_names')->default(true);
|
||||
$table->string('password_hash', 32);
|
||||
$table->string('password_salt', 5);
|
||||
$table->string('email', 150)->indexed();
|
||||
$table->string('gravatar')->nullable();
|
||||
$table->string('slug');
|
||||
|
|
|
@ -54,31 +54,43 @@
|
|||
}
|
||||
|
||||
public static function popular($count, $allowExplicit = false) {
|
||||
$tracks = Cache::remember('popular_tracks-' . ($allowExplicit ? 'explicit' : 'safe'), 5, function() use ($allowExplicit) {
|
||||
$trackIds = Cache::remember('popular_tracks-' . ($allowExplicit ? 'explicit' : 'safe'), 5, function() use ($allowExplicit) {
|
||||
$query = static
|
||||
::with(['user', 'genre', 'cover', 'user.avatar'])
|
||||
->published()
|
||||
->whereIsExplicit($allowExplicit)
|
||||
::published()
|
||||
->join(DB::raw('
|
||||
( SELECT `track_id`, `created_at`
|
||||
FROM `resource_log_items`
|
||||
WHERE `created_at` > now() - INTERVAL 1 DAY
|
||||
WHERE track_id IS NOT NULL AND log_type = 3 AND `created_at` > now() - INTERVAL 1 DAY
|
||||
) AS ranged_plays'),
|
||||
'tracks.id', '=', 'ranged_plays.track_id')
|
||||
->groupBy('id')
|
||||
->orderBy('plays', 'desc')
|
||||
->take(20);
|
||||
|
||||
if (!$allowExplicit)
|
||||
$query->whereIsExplicit(false);
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach($query->get(['*', DB::raw('count(*) as plays')]) as $track) {
|
||||
$results[] = self::mapPublicTrackSummary($track);
|
||||
$results[] = $track->id;
|
||||
}
|
||||
|
||||
return $results;
|
||||
});
|
||||
|
||||
return $tracks;
|
||||
$tracks = Track::summary()
|
||||
->userDetails()
|
||||
->explicitFilter()
|
||||
->published()
|
||||
->with('user', 'genre', 'cover', 'album', 'album.user')
|
||||
->whereIn('id', $trackIds);
|
||||
|
||||
$processed = [];
|
||||
foreach ($tracks->get() as $track)
|
||||
$processed[] = Track::mapPublicTrackSummary($track);
|
||||
|
||||
return $processed;
|
||||
}
|
||||
|
||||
public static function mapPublicTrackShow($track) {
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
@endsection
|
||||
|
||||
@section('styles')
|
||||
<link rel="stylesheet" type="text/css" href="/styles/loader.css" />
|
||||
{{ Assets::styleIncludes() }}
|
||||
@endsection
|
||||
|
||||
|
|
0
public/styles/loader.css
Normal file
0
public/styles/loader.css
Normal file
Loading…
Reference in a new issue