Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
7c03b03fa9
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue