pre_develop
jingquan huang 6 years ago
commit d02c056427

@ -3,7 +3,7 @@
module Mobile module Mobile
module Apis module Apis
class Cnmooc < Grape::API class Cnmooc < Grape::API
before {cnmooc_access_key!} # before {cnmooc_access_key!}
content_type :json, 'application/json;charset=UTF-8' content_type :json, 'application/json;charset=UTF-8'
resources :cnmoocs do resources :cnmoocs do
@ -39,7 +39,7 @@ module Mobile
desc "获取资源访问地址" desc "获取资源访问地址"
params do params do
requires :userId, type: Integer, desc: "用户ID" requires :userId, type: Integer, desc: "用户ID"
requires :resouceId, type: String, desc: "资源唯一标示" requires :resourceId, type: String, desc: "资源唯一标示"
requires :accessType, type: Integer, desc: "资源类型" requires :accessType, type: Integer, desc: "资源类型"
end end
get "source_url" do get "source_url" do
@ -72,7 +72,7 @@ module Mobile
desc "资源学习情况查询" desc "资源学习情况查询"
params do params do
requires :userId, type: Integer, desc: "用户ID" requires :userId, type: Integer, desc: "用户ID"
requires :resouceId, type: String, desc: "资源唯一标示" requires :resourceId, type: String, desc: "资源唯一标示"
end end
get 'get_students_data' do get 'get_students_data' do
CnmoocsService.new.get_students_data params CnmoocsService.new.get_students_data params

@ -52,7 +52,7 @@ module ZipService
members = exercise.course.members members = exercise.course.members
exercise_users.each do |exercise_user| exercise_users.each do |exercise_user|
member = members.where(:user_id => exercise_user.user_id).first member = members.where(:user_id => exercise_user.user_id).first
group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.try(:name)
export_file_name = "#{group_name}-#{exercise.course_id}-#{exercise.exercise_name}-#{exercise_user.user.user_extensions.student_id}-#{exercise_user.user.show_real_name}" + ".pdf" export_file_name = "#{group_name}-#{exercise.course_id}-#{exercise.exercise_name}-#{exercise_user.user.user_extensions.student_id}-#{exercise_user.user.show_real_name}" + ".pdf"
out_file = export_user_exercise(exercise, exercise_user, export_file_name) out_file = export_user_exercise(exercise, exercise_user, export_file_name)
file_name = File::expand_path(out_file) file_name = File::expand_path(out_file)

Loading…
Cancel
Save