xielin 5 yıl önce
ebeveyn
işleme
5fb5bb0cb3
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3 3
      app/Console/Commands/YesterdayGreatPost.php

+ 3 - 3
app/Console/Commands/YesterdayGreatPost.php

@@ -54,13 +54,13 @@ class YesterdayGreatPost extends Command
         $postData = $this->postData
             ->where('created_at', '>=', Carbon::yesterday()->startOfDay()->toDateTimeString())
             ->where('created_at', '<=', Carbon::yesterday()->endOfDay()->toDateTimeString())
-            ->get()->toArray();
+            ->select()->toArray();
         $postId = 0;
         $postScore = 0;
         foreach ($postData as $post) {
-            $score = $post->pv + $post->collect_count + $post->share_count + $post->comment_count;
+            $score = $post['pv'] + $post['collect_count'] + $post['share_count'] + $post['comment_count'];
             if($score>$postScore){
-                $postId = $post->post_id;
+                $postId = $post['post_id'];
             }
         }
         Redis::set('yesterday_great_post', $postId);