执行代码

Adjustreact
daiao 5 years ago
parent 579177bff1
commit 7496098027

@ -51,18 +51,14 @@ namespace :subjects do
"'#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')")
puts "index: #{index}; worker_number: #{Parallel.worker_number}"
puts "####str: #{str}"
if str.size == 50
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
end
end
if str.size > 0
sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
puts sql
ActiveRecord::Base.connection.execute sql
end
end
# if str.size > 0
# sql = "REPLACE INTO subject_records(#{column_value}) VALUES #{str.uniq.join(",")}"
# puts sql
# ActiveRecord::Base.connection.execute sql
# end
puts("---------------------data_statistic_end")
Rails.logger.info("---------------------data_statistic_end")
end

Loading…
Cancel
Save