diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index f189771e3..7399ebb4c 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -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 #发布时间 diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 29c4fb1b0..f5ff2670f 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -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