rake任务添加log
This commit is contained in:
parent
b89484c344
commit
3f667a7afc
|
@ -4,6 +4,7 @@ namespace :homework_publishtime do
|
||||||
desc "start publish homework and end homework"
|
desc "start publish homework and end homework"
|
||||||
task :publish => :environment do
|
task :publish => :environment do
|
||||||
puts "--------------------------------homework_publish start"
|
puts "--------------------------------homework_publish start"
|
||||||
|
Rails.logger.info("log--------------------------------homework_publish start")
|
||||||
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
|
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
|
||||||
homework_commons.each do |homework|
|
homework_commons.each do |homework|
|
||||||
homework_detail_manual = homework.homework_detail_manual
|
homework_detail_manual = homework.homework_detail_manual
|
||||||
|
@ -36,6 +37,7 @@ namespace :homework_publishtime do
|
||||||
Mailer.run.homework_added(homework)
|
Mailer.run.homework_added(homework)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Rails.logger.info("log--------------------------------homework_publish end")
|
||||||
puts "--------------------------------homework_publish end"
|
puts "--------------------------------homework_publish end"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,12 @@ namespace :resource_publish do
|
||||||
desc "start publish resource"
|
desc "start publish resource"
|
||||||
task :publish => :environment do
|
task :publish => :environment do
|
||||||
puts "--------------------------------resource_publish start"
|
puts "--------------------------------resource_publish start"
|
||||||
|
Rails.logger.info("log--------------------------------resource_publish start")
|
||||||
attachments = Attachment.where("publish_time = '#{Date.today}'")
|
attachments = Attachment.where("publish_time = '#{Date.today}'")
|
||||||
attachments.each do |attachment|
|
attachments.each do |attachment|
|
||||||
attachment.update_column('is_publish', 1)
|
attachment.update_column('is_publish', 1)
|
||||||
end
|
end
|
||||||
|
Rails.logger.info("log--------------------------------resource_publish end")
|
||||||
puts "--------------------------------resource_publish end"
|
puts "--------------------------------resource_publish end"
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue