From 2f762973b46fd3d1fedcd156fdd51538e0c57532 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sun, 1 Mar 2015 16:32:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E=E6=95=B0=E6=8D=AE=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/course_dynamic.rb | 9 ++++----- app/services/courses_service.rb | 8 +++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index 11f8c2682..5e22e3df7 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -6,12 +6,11 @@ module Mobile c[field] if (c.is_a?(Hash) && c.key?(field)) end end - + course_dynamic_expose :type + course_dynamic_expose :count course_dynamic_expose :course_name - course_dynamic_expose :need_anonymous_comments_count - course_dynamic_expose :student_commit_number - course_dynamic_expose :news_count - course_dynamic_expose :message_count + course_dynamic_expose :course_id + course_dynamic_expose :course_img_url end end end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 7fa78b635..ab0a53744 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -345,7 +345,13 @@ class CoursesService end news_count = course.news.count message_count = course.journals_for_messages.count - {:course_name => course.name,:need_anonymous_comments_count=>need_anonymous_comments_count,:student_commit_number=>student_commit_number,:news_count=> news_count,:message_count=>message_count} + result = [] + result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:type => 1,:count => message_count} + result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:type => 2,:count => need_anonymous_comments_count} + result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:type => 3,:count => student_commit_number} + result << {:course_name => course.name,:course_id => course.id,:course_img_url => url_to_avatar(course),:type => 4,:count => news_count} + #{:course_name => course.name,:need_anonymous_comments_count=>need_anonymous_comments_count,:student_commit_number=>student_commit_number,:news_count=> news_count,:message_count=>message_count} + result end private