This commit is contained in:
BoHung Chiu 2023-03-06 10:43:31 +08:00
parent a84765e4df
commit e28b785a41
1 changed files with 5 additions and 5 deletions

View File

@ -7,17 +7,17 @@ module EventNewsModel
end end
def do_before_save def do_before_save
if self.class == SubPart if self.class == SubPart
EventNewsCache.where(parent_id:self.id).destroy ::EventNewsCache.where(parent_id:self.id).destroy
elsif self.class == EventNews || (self.class == Page && self.module == "event_news") elsif self.class == ::EventNews || (self.class == Page && self.module == "event_news")
if self.class == EventNews if self.class == ::EventNews
tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq tmp_tag_ids = (Array(self.tag_ids) + Array(self.org_tag_ids)).uniq
Thread.new do Thread.new do
EventNewsCache.where(:uid.in => EventNewsFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).each do |cache| ::EventNewsCache.where(:uid.in => ::EventNewsFeed.where(:tag_ids.in => tmp_tag_ids.collect{|v| v.to_s}).pluck(:uid)).each do |cache|
cache.regenerate cache.regenerate
end end
end end
end end
EventNewsCache.all.destroy ::EventNewsCache.all.destroy
end end
end end
end end