socialforge/db/migrate/20150831093918_about_user_f...

37 lines
1.5 KiB
Ruby

class AboutUserFeedbackMessage < ActiveRecord::Migration
def up
# JournalsForMessage.all.each do |jour_for_message|
# transaction do
# # 主留言
# if jour_for_message.jour_type == 'Principal'
# receivers = []
# if jour_for_message.reply_id == 0
# if jour_for_message.user_id != jour_for_message.jour_id # 过滤自己给自己的留言消息
# receivers << jour_for_message.jour
# end
# else # 留言回复
# reply_to = User.find(jour_for_message.reply_id)
# if jour_for_message.user_id != jour_for_message.reply_id # 添加我回复的那个人
# receivers << reply_to
# end
# unless jour_for_message.parent.nil?
# if jour_for_message.user_id != jour_for_message.parent.jour_id && jour_for_message.reply_id != jour_for_message.parent.jour_id # 给东家发信息,如果回复的对象是东家则不发
# receivers << jour_for_message.parent.jour
# end
# end
# end
# unless receivers.blank?
# receivers.each do |r|
# puts jour_for_message.id
# jour_for_message.user_feedback_messages << UserFeedbackMessage.new(:user_id => r.id, :journals_for_message_id => jour_for_message.id, :journals_for_message_type => "Principal", :viewed => true)
# end
# end
# end
# end
# end
end
def down
end
end