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