parent
f0cac221e9
commit
0a33a716de
@ -0,0 +1,27 @@
|
||||
module Mobile
|
||||
module Entities
|
||||
class News < Grape::Entity
|
||||
def self.news_expose(field)
|
||||
expose field do |f,opt|
|
||||
if f.is_a?(Hash) && f.key?(field)
|
||||
f[field]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#新闻标题
|
||||
news_expose :title
|
||||
#作者id
|
||||
news_expose :author_id
|
||||
#作者名
|
||||
news_expose :author_name
|
||||
#新闻内容
|
||||
news_expose :content
|
||||
#发布时间
|
||||
news_expose :time
|
||||
#评论数量
|
||||
news_expose :comments_count
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue