From 63f8ca06dfbd9beb15c79936941e072722a0fc4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Tue, 27 Sep 2022 15:50:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6develop=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8Cpr=5Freviews?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 683e7b12..30ed693f 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -47,8 +47,13 @@ class RepositoriesController < ApplicationController end def entries - @project.increment!(:visits) - CacheAsyncSetJob.perform_later("project_common_service", {visits: 1}, @project.id) + @week_project_visit_record, @month_project_visit_record = TimeableVisitRecord.build(@project.id) + if @week_project_visit_record.visits < 300 && @month_project_visit_record.visits < 1000 + @week_project_visit_record.increment!(:visits) + @month_project_visit_record.increment!(:visits) + @project.increment!(:visits) + CacheAsyncSetJob.perform_later("project_common_service", {visits: 1}, @project.id) + end if @project.educoder? @entries = Educoder::Repository::Entries::ListService.call(@project&.project_educoder.repo_name) else