2020-03-01 07:49:01 +00:00
|
|
|
module BulletinModel
|
|
|
|
module Cache
|
|
|
|
require 'active_support/concern'
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
|
|
before_save :do_before_save
|
|
|
|
end
|
|
|
|
def do_before_save
|
|
|
|
if self.class == SubPart
|
|
|
|
AnnsCache.where(parent_id:self.id).destroy
|
2020-05-06 11:30:09 +00:00
|
|
|
elsif self.class == Bulletin || (self.class == Page && self.module == "announcement")
|
2020-07-20 15:48:24 +00:00
|
|
|
if self.class == Bulletin
|
2020-07-22 03:11:58 +00:00
|
|
|
BulletinFeedCache.where(:uid.in => BulletinFeed.where(:tag_ids.in => Array(self.tag_ids).collect{|v| v.to_s}).pluck(:uid)).destroy
|
2020-07-20 15:48:24 +00:00
|
|
|
end
|
2020-03-01 07:49:01 +00:00
|
|
|
AnnsCache.all.destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|