diff --git a/app/api/mobile/entities/attachment.rb b/app/api/mobile/entities/attachment.rb index bb67b6d28..ab6f6fd71 100644 --- a/app/api/mobile/entities/attachment.rb +++ b/app/api/mobile/entities/attachment.rb @@ -29,6 +29,8 @@ module Mobile attachment_expose :quotes attachment_expose :created_on attachment_expose :file_dir + attachment_expose :attafile_size + attachment_expose :coursename #所属班级名 end end end \ No newline at end of file diff --git a/app/api/mobile/entities/exercise.rb b/app/api/mobile/entities/exercise.rb index 3218264fb..14c530a9b 100644 --- a/app/api/mobile/entities/exercise.rb +++ b/app/api/mobile/entities/exercise.rb @@ -3,6 +3,7 @@ module Mobile class Exercise < Grape::Entity expose :exercise_name expose :exercise_description + expose :coursename #所属班级名 end end end diff --git a/app/api/mobile/entities/homework.rb b/app/api/mobile/entities/homework.rb index db3e44119..17127f0f2 100644 --- a/app/api/mobile/entities/homework.rb +++ b/app/api/mobile/entities/homework.rb @@ -94,6 +94,8 @@ module Mobile homework_expose :homework_anony_type #是否是匿评作业 + homework_expose :coursename #所属班级名 + end end end \ No newline at end of file diff --git a/app/services/resources_service.rb b/app/services/resources_service.rb index 96034b4ce..41f57429e 100644 --- a/app/services/resources_service.rb +++ b/app/services/resources_service.rb @@ -1,7 +1,7 @@ #coding=utf-8 class ResourcesService - + include ActionView::Helpers::NumberHelper #发送资源到课程 def send_resource_to_course user,params send_id = params[:send_id] @@ -59,6 +59,12 @@ class ResourcesService attchments = Attachment.where("(author_id = #{user.id} and is_publish = 1 and container_id in #{courses_ids} and container_type = 'Course') or (container_type = 'Course' and is_publish = 1 and container_id in #{courses_ids})" ).order("created_on desc") + attchments.each do |v| + course = Course.where("id=?",v.container_id).first + v[:coursename] = course.nil? ? "未知" : course.name + v[:attafile_size] = (number_to_human_size(v[:filesize])).gsub("ytes", "").to_s + end + attchments end @@ -71,6 +77,11 @@ class ResourcesService homeworks = HomeworkCommon.where("course_id in #{courses_ids} and publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc") + homeworks.each do |v| + course = Course.where("id=?",v.course_id).first + v[:coursename] = course.nil? ? "未知" : course.name + end + homeworks end @@ -83,6 +94,11 @@ class ResourcesService exercises = Exercise.where("exercise_status <> 1 and course_id in #{courses_ids}").order("created_at desc") + exercises.each do |v| + course = Course.where("id=?",v.course_id).first + v[:coursename] = course.nil? ? "未知" : course.name + end + exercises end diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index 4a28b2d3e..070ee5bef 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -12,22 +12,22 @@
暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。
暂无作业,
请登录Trustie网站,在PC浏览器中创建作业。
暂无测验,
请登录Trustie网站,在PC浏览器中创建测验。