xielin 5 jaren geleden
bovenliggende
commit
8b0b5fcd77
2 gewijzigde bestanden met toevoegingen van 7 en 7 verwijderingen
  1. 6 6
      app/Console/Commands/CalcPostWeight.php
  2. 1 1
      app/Repositories/PostRepositories.php

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

@@ -54,17 +54,17 @@ class CalcPostWeight extends Command
                 continue;
             }
             Log::debug('帖子:' . json_encode($postInfo));
-            $temp = ($postInfo['pv'] +
+            $temp = (0.2 * $postInfo['pv'] +
                 (5 * $postInfo->share_count) +
-                (2 * $postInfo->praise_count) +
+                (3 * $postInfo->praise_count) +
                 (10 * $postInfo->collect_count) +
-                (3 * $postInfo->comment_count) -
-                (10 * $postInfo->dislike_count));
+                (5 * $postInfo->comment_count) -
+                (23 * $postInfo->dislike_count));
             $fresh = (Carbon::parse($postInfo['created_at'])->timestamp) - (Carbon::parse("2019-05-01 00:00:00")->timestamp);
             if($temp){
-                $score = log10($temp) + $fresh / 86400;
+                $score = log10($temp) + $fresh / 43200;
             }else{
-                $score = $fresh / 86400;
+                $score = $fresh / 43200;
             }
             $post->weight = $score;
             $post->save();

+ 1 - 1
app/Repositories/PostRepositories.php

@@ -137,7 +137,7 @@ class PostRepositories
         }
 
         $fresh = (Carbon::now()->timestamp) - (Carbon::parse("2019-05-01 00:00:00")->timestamp);
-        $score = $fresh / 86400;
+        $score = $fresh / 43200;
         $data = [
             'uid' => $userInfo['uid'],
             'username' => $userInfo['username'],