|
@@ -5,6 +5,7 @@
|
|
* Date: 2019/6/20
|
|
* Date: 2019/6/20
|
|
* Time: 下午2:27
|
|
* Time: 下午2:27
|
|
*/
|
|
*/
|
|
|
|
+
|
|
namespace App\Console\Commands;
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
|
|
@@ -57,13 +58,12 @@ class RankingList extends Command
|
|
{
|
|
{
|
|
$yesterday_start = Carbon::now()->addDays(-1)->startOfDay()->toDateTimeString();
|
|
$yesterday_start = Carbon::now()->addDays(-1)->startOfDay()->toDateTimeString();
|
|
$yesterday_end = Carbon::now()->addDays(-1)->endOfDay()->toDateTimeString();
|
|
$yesterday_end = Carbon::now()->addDays(-1)->endOfDay()->toDateTimeString();
|
|
- return $model->select(DB::raw('count(*) as count'),'generation_quantity','content_author_id','related_content_id')
|
|
|
|
- ->whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
|
|
- ->groupBy('generation_quantity','related_content_id','content_author_id')
|
|
|
|
- ->orderBy('generation_quantity','desc')
|
|
|
|
|
|
+ return $model->select(DB::raw('count(*) as num'), 'generation_quantity', 'content_author_id', DB::raw('sum(generation_quantity) as count'))
|
|
|
|
+ ->whereBetween('created_at', [$yesterday_start, $yesterday_end])
|
|
|
|
+ ->groupBy('generation_quantity', 'content_author_id')
|
|
|
|
+ ->orderBy('count', 'desc')
|
|
->limit(10)
|
|
->limit(10)
|
|
->get();
|
|
->get();
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -96,15 +96,16 @@ class RankingList extends Command
|
|
}
|
|
}
|
|
$release_author = $this->releaseRecord
|
|
$release_author = $this->releaseRecord
|
|
->whereBetween('created_at', [$yesterday_start, $yesterday_end])
|
|
->whereBetween('created_at', [$yesterday_start, $yesterday_end])
|
|
- ->select(DB::raw('count(*) as count'), 'generation_quantity', 'uid as content_author_id', 'related_content_id')
|
|
|
|
- ->groupBy('generation_quantity', 'content_author_id', 'related_content_id')->orderBy('generation_quantity', 'desc')->limit(10)->get();
|
|
|
|
|
|
+ ->select(DB::raw('count(*) as num'), 'generation_quantity', 'uid as content_author_id', DB::raw('sum(generation_quantity) as count'))
|
|
|
|
+ ->groupBy('generation_quantity', 'content_author_id')->orderBy('count', 'desc')->limit(10)->get();
|
|
|
|
+
|
|
$release_best_author = $release_author->toArray();
|
|
$release_best_author = $release_author->toArray();
|
|
foreach ($release_best_author as $k => $v) {
|
|
foreach ($release_best_author as $k => $v) {
|
|
$release_best_author[$k]['type'] = 'release';
|
|
$release_best_author[$k]['type'] = 'release';
|
|
}
|
|
}
|
|
$all_best_author = array_merge($comment_best_author, $general_best_author, $release_best_author);
|
|
$all_best_author = array_merge($comment_best_author, $general_best_author, $release_best_author);
|
|
|
|
|
|
- $column = array_column($all_best_author, 'generation_quantity');
|
|
|
|
|
|
+ $column = array_column($all_best_author, 'count');
|
|
array_multisort($column, SORT_DESC, $all_best_author);
|
|
array_multisort($column, SORT_DESC, $all_best_author);
|
|
|
|
|
|
$all_best_author = array_slice($all_best_author, 0, 10);
|
|
$all_best_author = array_slice($all_best_author, 0, 10);
|