课程评论添加上拉分页

This commit is contained in:
lizanle 2015-05-29 14:22:43 +08:00
parent 1e4afc24b9
commit 849af9b04b
3 changed files with 3 additions and 1 deletions

View File

@ -91,6 +91,7 @@ module Mobile
desc '课程留言列表'
params do
optional :token, type: String
optional :page,type:Integer,desc:'页数'
end
get ':id/course_message' do
cs = CommentService.new

View File

@ -94,7 +94,7 @@ class CommentService
def course_messages params,current_user
@course = ::Course.find(params[:id])
if (current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course)))
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jours = @course.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC').page(params[:page] ||= 1).per(10)
else
raise '403'
end

View File

@ -292,6 +292,7 @@ class UsersService
jours
end
# 所有的与我相关
def reply_my_messages params,current_user
jours = my_personal_messages params,current_user
jours1 = my_course_messages params,current_user