From f1c0c402ebc757f82bcc854eafccc47c62e48087 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 31 May 2019 16:49:45 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/zip_service.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb index 759c7afa..8864999d 100644 --- a/app/services/zip_service.rb +++ b/app/services/zip_service.rb @@ -50,10 +50,11 @@ module ZipService bid_homework_path = [] digests = [] members = exercise.course.members - exercise_users.each do |exercise_user| + exercise_users.each_with_index do |exercise_user, index| member = members.where(:user_id => exercise_user.user_id).first group_name = member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.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" + export_file_name = "#{exercise.course_id}-#{index+1}" + ".pdf" out_file = export_user_exercise(exercise, exercise_user, export_file_name) file_name = File::expand_path(out_file) From bf178e6647cc61b38cec807a2205427b3f4445b7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 31 May 2019 16:52:56 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/zip_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb index 8864999d..ef71063e 100644 --- a/app/services/zip_service.rb +++ b/app/services/zip_service.rb @@ -52,7 +52,7 @@ module ZipService members = exercise.course.members exercise_users.each_with_index do |exercise_user, index| 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 = "#{exercise.course_id}-#{index+1}" + ".pdf" out_file = export_user_exercise(exercise, exercise_user, export_file_name) From 1f3cf342bad46378897b30f69e4047522aa92550 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 31 May 2019 17:02:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/zip_service.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb index ef71063e..cb278e98 100644 --- a/app/services/zip_service.rb +++ b/app/services/zip_service.rb @@ -50,11 +50,10 @@ module ZipService bid_homework_path = [] digests = [] members = exercise.course.members - exercise_users.each_with_index do |exercise_user, index| + exercise_users.each do |exercise_user| member = members.where(:user_id => exercise_user.user_id).first 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 = "#{exercise.course_id}-#{index+1}" + ".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) file_name = File::expand_path(out_file) From 39c07c7b300fa8bd6a6133765e20141b91da7c35 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 31 May 2019 19:09:12 +0800 Subject: [PATCH 4/5] ttt --- app/api/mobile/apis/cnmooc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 7745cf8e..fb736737 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -3,7 +3,7 @@ module Mobile module Apis class Cnmooc < Grape::API - before {cnmooc_access_key!} + # before {cnmooc_access_key!} content_type :json, 'application/json;charset=UTF-8' resources :cnmoocs do From c1f6890f2898369d1ec15b18d5559ed3597c7da6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 31 May 2019 19:37:40 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/cnmooc.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 7745cf8e..a5540327 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -39,7 +39,7 @@ module Mobile desc "获取资源访问地址" params do requires :userId, type: Integer, desc: "用户ID" - requires :resouceId, type: String, desc: "资源唯一标示" + requires :resourceId, type: String, desc: "资源唯一标示" requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do @@ -72,7 +72,7 @@ module Mobile desc "资源学习情况查询" params do requires :userId, type: Integer, desc: "用户ID" - requires :resouceId, type: String, desc: "资源唯一标示" + requires :resourceId, type: String, desc: "资源唯一标示" end get 'get_students_data' do CnmoocsService.new.get_students_data params