2016-02-22 18:35:04 +08:00
|
|
|
#coding=utf-8
|
|
|
|
|
|
|
|
namespace :resource_publish do
|
|
|
|
desc "start publish resource"
|
|
|
|
task :publish => :environment do
|
2016-10-15 12:36:07 +08:00
|
|
|
puts "--------------------------------resource_publish start"
|
2016-10-15 15:13:15 +08:00
|
|
|
Rails.logger.info("log--------------------------------resource_publish start")
|
2016-10-14 16:44:37 +08:00
|
|
|
attachments = Attachment.where("publish_time = '#{Date.today}'")
|
2016-02-22 18:35:04 +08:00
|
|
|
attachments.each do |attachment|
|
2016-10-14 16:44:37 +08:00
|
|
|
attachment.update_column('is_publish', 1)
|
2016-02-22 18:35:04 +08:00
|
|
|
end
|
2016-10-15 15:13:15 +08:00
|
|
|
Rails.logger.info("log--------------------------------resource_publish end")
|
2016-10-15 12:36:07 +08:00
|
|
|
puts "--------------------------------resource_publish end"
|
2016-02-22 18:35:04 +08:00
|
|
|
end
|
|
|
|
end
|