rake任务添加log

This commit is contained in:
huang 2016-10-15 15:13:15 +08:00
parent b89484c344
commit 3f667a7afc
2 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ namespace :homework_publishtime do
desc "start publish homework and end homework"
task :publish => :environment do
puts "--------------------------------homework_publish start"
Rails.logger.info("log--------------------------------homework_publish start")
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
homework_commons.each do |homework|
homework_detail_manual = homework.homework_detail_manual
@ -36,6 +37,7 @@ namespace :homework_publishtime do
Mailer.run.homework_added(homework)
end
end
Rails.logger.info("log--------------------------------homework_publish end")
puts "--------------------------------homework_publish end"
end

View File

@ -4,10 +4,12 @@ namespace :resource_publish do
desc "start publish resource"
task :publish => :environment do
puts "--------------------------------resource_publish start"
Rails.logger.info("log--------------------------------resource_publish start")
attachments = Attachment.where("publish_time = '#{Date.today}'")
attachments.each do |attachment|
attachment.update_column('is_publish', 1)
end
Rails.logger.info("log--------------------------------resource_publish end")
puts "--------------------------------resource_publish end"
end
end