From 29dda04a2dc0df679f938b4239440a524fd562c2 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 6 Jan 2017 14:52:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E9=87=8F=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 7 ++----- app/services/zip_service.rb | 8 +++++--- lib/tasks/zip.rake | 4 ---- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index b4be08b39..6ed1a2e4b 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -5,12 +5,11 @@ class ZipdownController < ApplicationController before_filter :find_project_by_bid_id, :only => [:assort] #检查权限 #勿删 before_filter :authorize, :only => [:assort,:download_user_homework] - SAVE_FOLDER = "#{Rails.root}/files" - OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" - MAX_PATH = 50 ## 200M MAX_DOWN_SIZE = 200 * 1024 * 1024 + include ZipService + #统一下载功能 def download if User.current.logged? @@ -114,6 +113,4 @@ class ZipdownController < ApplicationController end end - include ZipService - end diff --git a/app/services/zip_service.rb b/app/services/zip_service.rb index 2810bcf0b..0866033bd 100644 --- a/app/services/zip_service.rb +++ b/app/services/zip_service.rb @@ -1,10 +1,12 @@ require "base64" require 'zip' -SAVE_FOLDER = "#{Rails.root}/files" -OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" -MAX_PATH = 50 module ZipService + + SAVE_FOLDER = "#{Rails.root}/files" + OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" + MAX_PATH = 50 + def zip_bid(bid) # Todo: User Access Controll bid_homework_path = [] diff --git a/lib/tasks/zip.rake b/lib/tasks/zip.rake index 862e7aab5..ca5707989 100644 --- a/lib/tasks/zip.rake +++ b/lib/tasks/zip.rake @@ -1,9 +1,5 @@ #coding=utf-8 -SAVE_FOLDER = "#{Rails.root}/files" -OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip" -MAX_PATH = 50 - namespace :zip do desc "手工打包作品" task :pack => :environment do