fix error

This commit is contained in:
邱博亞 committed 2021-11-18 13:59:37 +08:00
1 parent 38e130664e
commit 430c673fdf
3 files changed
+10 -2

No files matched your search

+4
View File
@@ -7,6 +7,10 @@ module FeedModel
before_save :do_before_save
end
def recreate_annc_cache(feed)
count = SiteFeedAnnc.where(feed_id: feed.id).count
if count>1
SiteFeedAnnc.where(feed_id: feed.id).limit(count-1).destroy
end
tmp = SiteFeedAnnc.where(feed_id: feed.id).first
if tmp.nil?
tmp = SiteFeedAnnc.new(feed_id: feed.id)