From 61c9083ceb2b1d1aea782c8152af83526662e5c7 Mon Sep 17 00:00:00 2001 From: miaowuawa <2484667023@qq.com> Date: Thu, 17 Jul 2025 12:05:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/core/cs/metrics.go | 5 ++++- scripts/migration/sqlite3/0013_rank_metrics.up.sql | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/core/cs/metrics.go b/internal/core/cs/metrics.go index 169126d3..dfcc78bc 100644 --- a/internal/core/cs/metrics.go +++ b/internal/core/cs/metrics.go @@ -36,7 +36,10 @@ type CommentMetric struct { } func (m *CommentMetric) RankScore(motivationFactor int) int64 { - return int64(m.IncentiveScore * motivationFactor / m.DecayFactor) + if m.DecayFactor == 0 { + return 0 + } + return int64(m.IncentiveScore * motivationFactor / m.DecayFactor) } // UserMetric 用户指标结构体 diff --git a/scripts/migration/sqlite3/0013_rank_metrics.up.sql b/scripts/migration/sqlite3/0013_rank_metrics.up.sql index 002ec92c..5ced79db 100644 --- a/scripts/migration/sqlite3/0013_rank_metrics.up.sql +++ b/scripts/migration/sqlite3/0013_rank_metrics.up.sql @@ -17,6 +17,8 @@ CREATE TABLE p_comment_metric ( "decay_factor" integer NOT NULL DEFAULT 0, "motivation_factor" integer NOT NULL DEFAULT 0, "reply_count" integer NOT NULL DEFAULT 0, + "thumbs_up_count" integer NOT NULL DEFAULT 0, + "thumbs_down_count" integer NOT NULL DEFAULT 0, "is_del" integer NOT NULL DEFAULT 0, "created_on" integer NOT NULL DEFAULT 0, "modified_on" integer NOT NULL DEFAULT 0,