forgeplus/app/models/topic/join_us.rb

35 lines
745 B
Ruby

# == Schema Information
#
# Table name: topics
#
# id :integer not null, primary key
# type :string(255)
# title :string(255)
# uuid :integer
# url :string(255)
# order_index :integer
# location :integer default("0")
#
# 底部加入我们
class Topic::JoinUs < Topic
def memo_data
data = {
content: '',
visits: 0,
created_time: format_time(Time.now),
}
memo = Forum::Memos::GetService.call(self.uuid)
data[:content] = memo['memo']['content']
data[:visits] = memo['memo']['viewed_count']
data[:created_time] = memo.nil? ? format_time(Time.now) : memo["memo"]["published_time"]
return data
rescue
return data
end
end