xielin 5 年之前
父節點
當前提交
68f48ed843
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      app/Console/Commands/CalcPostWeight.php

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

@@ -42,7 +42,7 @@ class CalcPostWeight extends Command
      */
     public function handle()
     {
-        $this->line('开始计算权重');
+        $this->line(date('Y-m-d H:i:s').'开始计算权重');
         $key = "community_calc_post_score";
         $postIds = Redis::smembers($key);
         Log::debug('权重帖子ID:' . json_encode($postIds));
@@ -55,13 +55,13 @@ class CalcPostWeight extends Command
                 (10 * $postInfo->collect_count) +
                 (3 * $postInfo->comment_count) -
                 (10 * $postInfo->dislike_count));
-            Log::debug('帖子temp:' . $temp);
             $fresh = (Carbon::parse($postInfo['created_at'])->timestamp) - (Carbon::parse("2019-05-01 00:00:00")->timestamp);
             $score = log10($temp) + $fresh / 86400;
             $postInfo->weight = $score;
             $postInfo->save();
             Redis::srem($key,$postId);
-            $this->line(date("Y-m-d H:i:s") . "设置帖子" . $postInfo->post_id . "的权重分为:" . $score);
+            Log::debug(date("Y-m-d H:i:s") . "设置帖子" . $postInfo->post_id . "的权重分为:" . $score);
         }
+        $this->line(date('Y-m-d H:i:s').' 计算权重结束');
     }
 }