fix error

This commit is contained in:
chiu 2021-09-16 00:06:43 +08:00
parent ae965bbb6a
commit 09121746a2
2 changed files with 3 additions and 2 deletions

View File

@ -189,7 +189,7 @@ class Admin::FeedsController < OrbitAdminController
def force_refresh def force_refresh
sf = SiteFeed.find_by(:feed_uid => params[:feed_uid]) rescue nil sf = SiteFeed.find_by(:feed_uid => params[:feed_uid]) rescue nil
if !sf.nil? if !sf.nil?
sf.get_annc(true) FeedModel::Cache.recreate_annc_cache(sf)
end end
render :json => {"success" => true}.to_json render :json => {"success" => true}.to_json
end end

View File

@ -2,6 +2,7 @@ module FeedModel
module Cache module Cache
require 'active_support/concern' require 'active_support/concern'
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend self
included do included do
before_save :do_before_save before_save :do_before_save
end end
@ -11,7 +12,7 @@ module FeedModel
tmp = SiteFeedAnnc.new(feed_id: feed.id) tmp = SiteFeedAnnc.new(feed_id: feed.id)
end end
tmp[:feed_name] = feed[:feed_name] tmp[:feed_name] = feed[:feed_name]
tmp.all_contents_for_feed = feed.get_annc tmp.all_contents_for_feed = feed.get_annc(true)
tmp.merge_with_category = feed.merge_with_category tmp.merge_with_category = feed.merge_with_category
tmp.channel_key = feed.channel_key tmp.channel_key = feed.channel_key
tmp.category_title = feed.category[:title] rescue {} tmp.category_title = feed.category[:title] rescue {}