课程动态接口返回数据格式修改
This commit is contained in:
parent
196ceff138
commit
2f762973b4
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue