This commit is contained in:
sw 2015-03-07 17:20:50 +08:00
commit 7c03b03fa9
2 changed files with 22 additions and 0 deletions

View File

@ -87,6 +87,17 @@ module Mobile
present :status, 0
end
desc '课程留言列表'
params do
optional :token, type: String
end
get ':id/course_message' do
cs = CommentService.new
jours = cs.course_messages params,(current_user.nil? ? User.find(2):current_user)
present :data, jours, with: Mobile::Entities::Jours
present :status, 0
end
end
end
end

View File

@ -87,4 +87,15 @@ class CommentService
@memo
end
#课程留言列表
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')
else
raise '403'
end
@jours
end
end