From 6cf51901d8d96230ac9639fb11447b80bdce8bf7 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 6 Jun 2024 16:34:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fixed=20=E6=97=A5=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=BC=80=E5=A7=8B=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/daily_platform_statistics_job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/daily_platform_statistics_job.rb b/app/jobs/daily_platform_statistics_job.rb index 5610f304..a65fa3c6 100644 --- a/app/jobs/daily_platform_statistics_job.rb +++ b/app/jobs/daily_platform_statistics_job.rb @@ -12,7 +12,7 @@ class DailyPlatformStatisticsJob < ApplicationJob ActiveJob::Base.logger.info "job baidu_tongji_auth access_token ===== #{access_token}" # 从最后一个记录日期开始,如果遗漏日期数据可以补充数据 last_date = DailyPlatformStatistic.order(:date).last - start_date = last_date.date + start_date = last_date.present? ? last_date.date : 1.days.ago.beginning_of_day end_date = Time.now if access_token.present? tongji_service.overview_batch_add(start_date, end_date) From 756e308e06995eb08b3c1c4390c41e2b7141568a Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 7 Jun 2024 10:40:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9Areadme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/repositories_helper.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 79e58346..24eb7c5b 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -147,6 +147,7 @@ module RepositoriesHelper ss_href = content.to_s.scan(href_regex) ss_href_1 = content.to_s.scan(href_regex_1) total_sources = {ss_c: ss_c,ss: ss, ss_1: ss_1, ss_2: ss_2, ss_src: ss_src, ss_src_1: ss_src_1, ss_src_2: ss_src_2, ss_src_3: ss_src_3, ss_src_4: ss_src_4, ss_src_5: ss_src_5, ss_href: ss_href, ss_href_1: ss_href_1} + puts total_sources # total_sources.uniq! total_sources.except(:ss, :ss_c).each do |k, sources| sources.each do |s| @@ -210,14 +211,14 @@ module RepositoriesHelper end end - after_ss_souces = content.to_s.scan(s_regex).uniq + after_ss_souces = content.to_s.scan(s_regex)#.uniq after_ss_souces.each_with_index do |s, index| + next if total_sources[:ss][index].nil? content = content.gsub("#{s[0]}","#{total_sources[:ss][index][0]}") end - after_ss_c_souces = content.to_s.scan(s_regex_c).uniq - puts after_ss_c_souces - puts total_sources + after_ss_c_souces = content.to_s.scan(s_regex_c)#.uniq after_ss_c_souces.each_with_index do |s, index| + next if total_sources[:ss_c][index].nil? content = content.gsub("#{s[0]}","#{total_sources[:ss_c][index][0]}") end return content