添加显示课程的课件列表
This commit is contained in:
parent
ee0ef7dc69
commit
519eab76bd
|
@ -228,6 +228,18 @@ module Mobile
|
||||||
present :status, 0
|
present :status, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc '课程课件'
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
requires :course_id,type: Integer,desc: '课程id'
|
||||||
|
end
|
||||||
|
get ":course_id/attachments" do
|
||||||
|
cs = CoursesService.new
|
||||||
|
count = cs.course_attachments params
|
||||||
|
present :data, count, with: Mobile::Entities::Attachment
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,8 +16,11 @@ module Mobile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
attachment_expose :id
|
||||||
attachment_expose :filename
|
attachment_expose :filename
|
||||||
attachment_expose :description
|
attachment_expose :description
|
||||||
|
attachment_expose :downloads
|
||||||
|
attachment_expose :quotes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -428,6 +428,17 @@ class CoursesService
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 课程课件
|
||||||
|
def course_attachments params
|
||||||
|
result = []
|
||||||
|
@course = Course.find(params[:course_id])
|
||||||
|
@attachments = @course.attachments.order("created_on desc")
|
||||||
|
@attachments.each do |atta|
|
||||||
|
result << {:filename => atta.filename,:description => atta.description,:downloads => atta.downloads,:quotes => atta.quotes.nil? ? 0 :atta.quotes }
|
||||||
|
end
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def show_homework_info course,bid,current_user,is_course_teacher
|
def show_homework_info course,bid,current_user,is_course_teacher
|
||||||
author_real_name = bid.author.lastname + bid.author.firstname
|
author_real_name = bid.author.lastname + bid.author.firstname
|
||||||
|
|
Loading…
Reference in New Issue