修改news api
This commit is contained in:
parent
c9a614d520
commit
09b6f1d787
|
@ -26,13 +26,15 @@ module Mobile
|
|||
news_expose :title
|
||||
|
||||
expose :author,using: Mobile::Entities::User do |f, opt|
|
||||
n = f[:news]
|
||||
n.author if n.respond_to?(:author)
|
||||
n = f[:author]
|
||||
#n.author if n.respond_to?(:author)
|
||||
end
|
||||
#作者id
|
||||
news_expose :author_id
|
||||
#作者名
|
||||
news_expose :author_name
|
||||
#作者头像url
|
||||
news_expose :author_img_url
|
||||
#新闻内容
|
||||
news_expose :description
|
||||
#发布时间
|
||||
|
|
|
@ -123,7 +123,7 @@ class CoursesService
|
|||
scope = @course ? @course.news.course_visible(current_user) : News.course_visible(current_user)
|
||||
news = []
|
||||
scope.each do |n|
|
||||
news << {:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count}
|
||||
news << {:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :author=>n.author, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count}
|
||||
end
|
||||
news
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue