From c8e063343e9cc6eed6f427eb0652ab62d44e9056 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 27 Oct 2022 16:46:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=8E=92=E8=A1=8C=E6=A6=9C=E6=95=B0=E9=87=8F=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E9=A1=B9=E7=9B=AE=E6=8E=92=E8=A1=8C=E6=A6=9C=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=B2=BE=E9=80=89=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_rank_controller.rb | 1 + app/controllers/user_rank_controller.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/project_rank_controller.rb b/app/controllers/project_rank_controller.rb index 7bd62987..158f5add 100644 --- a/app/controllers/project_rank_controller.rb +++ b/app/controllers/project_rank_controller.rb @@ -5,6 +5,7 @@ class ProjectRankController < ApplicationController deleted_data = $redis_cache.smembers("v2-project-rank-deleted") $redis_cache.zrem("recent-days-project-rank", deleted_data) unless deleted_data.blank? @project_rank = $redis_cache.zrevrange("recent-days-project-rank", 0, 4, withscores: true) + @project_rank = Project.recommend.order("recommend_index desc").limit(4).pluck(:id).map{|p| [p.to_s, 0]} if @project_rank.blank? rescue Exception => e @project_rank = [] end diff --git a/app/controllers/user_rank_controller.rb b/app/controllers/user_rank_controller.rb index dddca485..a06416bc 100644 --- a/app/controllers/user_rank_controller.rb +++ b/app/controllers/user_rank_controller.rb @@ -2,7 +2,7 @@ class UserRankController < ApplicationController # 根据时间获取热门开发者 def index $redis_cache.zunionstore("recent-days-user-rank", get_timeable_key_names) - @user_rank = $redis_cache.zrevrange("recent-days-user-rank", 0, 3, withscores: true) + @user_rank = $redis_cache.zrevrange("recent-days-user-rank", 0, 19, withscores: true) rescue Exception => e @user_rank = [] end From d613b1f3bb8496416a099080a3049052acaa9e17 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 27 Oct 2022 16:58:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_rank_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/project_rank_controller.rb b/app/controllers/project_rank_controller.rb index 158f5add..2dc66e25 100644 --- a/app/controllers/project_rank_controller.rb +++ b/app/controllers/project_rank_controller.rb @@ -5,7 +5,7 @@ class ProjectRankController < ApplicationController deleted_data = $redis_cache.smembers("v2-project-rank-deleted") $redis_cache.zrem("recent-days-project-rank", deleted_data) unless deleted_data.blank? @project_rank = $redis_cache.zrevrange("recent-days-project-rank", 0, 4, withscores: true) - @project_rank = Project.recommend.order("recommend_index desc").limit(4).pluck(:id).map{|p| [p.to_s, 0]} if @project_rank.blank? + @project_rank = Project.recommend.order("recommend_index desc").limit(5).pluck(:id).map{|p| [p.to_s, 0]} if @project_rank.blank? rescue Exception => e @project_rank = [] end