|
@@ -66,7 +66,7 @@ class BeanRepository
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
->groupBy('related_content_id', 'content_author_id')->orderBy('count', 'desc')->limit(1)->get();
|
|
$collent = $collent->toArray();
|
|
$collent = $collent->toArray();
|
|
foreach ($collent as $k=>$v){
|
|
foreach ($collent as $k=>$v){
|
|
- $collent[$k]['type'] = 'collent';
|
|
|
|
|
|
+ $collent[$k]['type'] = 'collect';
|
|
}
|
|
}
|
|
|
|
|
|
//文章被喜欢最多用户
|
|
//文章被喜欢最多用户
|
|
@@ -150,8 +150,6 @@ class BeanRepository
|
|
|
|
|
|
public function rankingList($request)
|
|
public function rankingList($request)
|
|
{
|
|
{
|
|
- $yesterday_start = Carbon::now()->addDays(-1)->startOfDay()->toDateTimeString();
|
|
|
|
- $yesterday_end = Carbon::now()->addDays(-1)->endOfDay()->toDateTimeString();
|
|
|
|
if ($request['type'] == 0){//排行榜赚豆达人
|
|
if ($request['type'] == 0){//排行榜赚豆达人
|
|
$yesterday = Carbon::yesterday()->toDateString();
|
|
$yesterday = Carbon::yesterday()->toDateString();
|
|
$all_beans = Redis::ZREVRANGEBYSCORE('user_rainbow_bean'.$yesterday, 100000000, 0, array('WITHSCORES'=>true,'limit' => array(0, 20)));
|
|
$all_beans = Redis::ZREVRANGEBYSCORE('user_rainbow_bean'.$yesterday, 100000000, 0, array('WITHSCORES'=>true,'limit' => array(0, 20)));
|
|
@@ -175,15 +173,8 @@ class BeanRepository
|
|
return $new_arr;
|
|
return $new_arr;
|
|
|
|
|
|
}elseif ($request['type'] == 1){//排行榜人脉达人
|
|
}elseif ($request['type'] == 1){//排行榜人脉达人
|
|
-// $registered_most = Redis::get('yesterday_registered_most');
|
|
|
|
-// $registered_mosts = json_decode($registered_most,true);
|
|
|
|
-
|
|
|
|
- //昨日拉新最多前十人
|
|
|
|
- $registered_most = RegisteredRecord::
|
|
|
|
-// whereBetween('created_at', [$yesterday_start,$yesterday_end])
|
|
|
|
- select(DB::raw('count(*) as count'),'superior_uid')
|
|
|
|
- ->groupBy('superior_uid')->orderBy('count','desc')->limit(10)->get();
|
|
|
|
- $registered_most = $registered_most->toArray();
|
|
|
|
|
|
+ $registered_mosts = Redis::get('yesterday_registered_most');
|
|
|
|
+ $registered_most = json_decode($registered_mosts,true);
|
|
|
|
|
|
$superior_uid = array_column($registered_most,'superior_uid');
|
|
$superior_uid = array_column($registered_most,'superior_uid');
|
|
$uids = implode(',', array_unique($superior_uid));
|
|
$uids = implode(',', array_unique($superior_uid));
|
|
@@ -199,39 +190,9 @@ class BeanRepository
|
|
return $registered_most;
|
|
return $registered_most;
|
|
|
|
|
|
}else{//排行榜最佳作者
|
|
}else{//排行榜最佳作者
|
|
-// $all_best_author = Redis::get('yesterday_best_author');
|
|
|
|
-// $all_best_authors = json_decode($all_best_author,true);
|
|
|
|
- //昨日文章产生彩虹豆最多前十人
|
|
|
|
- $comment_author = CommentRecord::select(DB::raw('count(*) as count'),'generation_quantity','content_author_id','related_content_id')->groupBy('generation_quantity','related_content_id','content_author_id')
|
|
|
|
- ->orderBy('generation_quantity','desc')
|
|
|
|
- ->limit(10)
|
|
|
|
- ->get();;
|
|
|
|
- $comment_best_author = $comment_author->toArray();
|
|
|
|
- foreach ($comment_best_author as $k=>$v){
|
|
|
|
- $comment_best_author[$k]['type'] = 'comment';
|
|
|
|
- }
|
|
|
|
- $general_author = GeneralRecord::select(DB::raw('count(*) as count'),'generation_quantity','content_author_id','related_content_id')->groupBy('generation_quantity','related_content_id','content_author_id')
|
|
|
|
- ->orderBy('generation_quantity','desc')
|
|
|
|
- ->limit(10)
|
|
|
|
- ->get();;;
|
|
|
|
- $general_best_author = $general_author->toArray();
|
|
|
|
- foreach ($general_best_author as $k=>$v){
|
|
|
|
- $general_best_author[$k]['type'] = 'general';
|
|
|
|
- }
|
|
|
|
- $release_author =ReleaseRecord::
|
|
|
|
-// ->where('created_at', '>=', $time)
|
|
|
|
- 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();
|
|
|
|
- $release_best_author = $release_author->toArray();
|
|
|
|
- foreach ($release_best_author as $k=>$v){
|
|
|
|
- $release_best_author[$k]['type'] = 'release';
|
|
|
|
- }
|
|
|
|
- $all_best_author = array_merge($comment_best_author,$general_best_author,$release_best_author);
|
|
|
|
-
|
|
|
|
- $column = array_column($all_best_author,'generation_quantity');
|
|
|
|
- array_multisort($column,SORT_DESC,$all_best_author);
|
|
|
|
|
|
+ $all_best_authors = Redis::get('yesterday_best_author');
|
|
|
|
+ $all_best_author = json_decode($all_best_authors,true);
|
|
|
|
|
|
- $all_best_author = array_slice($all_best_author,0,10);
|
|
|
|
$content_author_id = array_column($all_best_author,'content_author_id');
|
|
$content_author_id = array_column($all_best_author,'content_author_id');
|
|
$uids = implode(',', array_unique($content_author_id));
|
|
$uids = implode(',', array_unique($content_author_id));
|
|
$user_data = $this->getFollowMembersStatus($uids);
|
|
$user_data = $this->getFollowMembersStatus($uids);
|