|
@@ -54,17 +54,18 @@ class YesterdayGreatPost extends Command
|
|
|
$postData = $this->postData
|
|
|
->where('created_at', '>=', Carbon::yesterday()->startOfDay()->toDateTimeString())
|
|
|
->where('created_at', '<=', Carbon::yesterday()->endOfDay()->toDateTimeString())
|
|
|
- ->select()->toArray();
|
|
|
+ ->select();
|
|
|
$postId = 0;
|
|
|
- $postScore = 0;
|
|
|
- foreach ($postData as $post) {
|
|
|
- $score = $post['pv'] + $post['collect_count'] + $post['share_count'] + $post['comment_count'];
|
|
|
- if($score>$postScore){
|
|
|
- $postId = $post['post_id'];
|
|
|
+ if($postData){
|
|
|
+ $postScore = 0;
|
|
|
+ foreach ($postData as $post) {
|
|
|
+ $score = $post->pv + $post->collect_count + $post->share_count + $post->comment_count;
|
|
|
+ if($score>$postScore){
|
|
|
+ $postId = $post->post_id;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
Redis::set('yesterday_great_post', $postId);
|
|
|
-
|
|
|
$this->line(date('Y-m-d H:i:s')."统计昨日最佳内容结束".$postId);
|
|
|
|
|
|
}
|