敗家子 The King of Yees 🇹🇼  ·  1年前

熱門梗圖的排行是怎麼算的

熱門梗圖的排行是怎麼算的

按讚的人:

共有 2 則留言

站長阿川 🌏 PRO 1年前

目前公式這樣

但應該沒人看得懂

我再找時間跟大家說明

    function refreshTrendingScore()
    {
        if ($this->approved_at < \Carbon\Carbon::now()->subHours(
            24 * trending_image_beginning_live_days() + $this->total_like_count * trending_image_extra_hours_per_like()
        )) {
            $this->trending_score = 0;

            $this->save();

            return;
        }

        $score = 100;

        $elapsedHours = \Carbon\Carbon::now()->diffInHours($this->approved_at);

        if ($elapsedHours > 24) {
            $score = $score + 24 - $elapsedHours;
        }

        $userId = $this->user_id;

        $score += $this->likes->filter(function($like) use ($userId) {
            return $userId != $like->user_id;
        })->count() * 2;

        $score += $this->comments->filter(function($comment) use ($userId) {
            return $userId != $comment->user_id;
        })->count() * 1;

        $reportsNum = Report::where('url', '/wtf/' . $this->id)
            ->distinct('user_id')
            ->count('user_id');

        $score -= $reportsNum * 5;

        if ($this->is_sensitive) {
            $score = 0;
        }

        $this->trending_score = $score;

        $this->save();
    }
按讚的人:
??? (愛国愛党) 🇭🇰 1年前

大概看得懂

按讚的人:
Meme 梗圖倉庫 - 輕鬆閒聊區
歡迎大家自由貼文閒聊、交流哦~
但如果色氣太重、尺度太大,我會視情節刪除喔~
  加入部落
建立日期:2021年06月20日