提供zip下载功能

pre_develop
jingquan huang 6 years ago
parent 0f20c7562d
commit 1754579a93

@ -15,7 +15,8 @@ class Myshixun < ActiveRecord::Base
belongs_to :user belongs_to :user
validates_uniqueness_of :shixun_id, :scope => :user_id, :message => "error" validates_uniqueness_of :shixun_id, :scope => :user_id, :message => "error"
# validates :shixun_id, :uniqueness => {:scope => :user_id, :message => "不能被重复开启"} # validates :shixun_id, :uniqueness => {:scope => :user_id, :message => "不能被重复开启"}
scope :min, lambda { select([:id, :shixun_id, :identifier, :gpid, :status, :user_id, :commit_id, :modify_time, :reset_time, :system_tip]) } scope :min, lambda { select([:id, :shixun_id, :identifier, :gpid, :status, :user_id, :commit_id, :modify_time, :reset_time,
:system_tip, :gpid]) }
scope :finished, lambda{where(status: 1)} scope :finished, lambda{where(status: 1)}
def output_times def output_times

@ -89,14 +89,17 @@ class GamesService
end end
url = service_host +":#{res['port']}/vnc_lite.html" url = service_host +":#{res['port']}/vnc_lite.html"
Rails.logger.info("66666666sssssss#{url}") Rails.logger.info("66666666sssssss#{url}")
container = container.merge(:vnc_url => url, :test => "666") container = container.merge(:vnc_url => url)
Rails.logger.info("777777666sssssss#{container}") Rails.logger.info("777777666sssssss#{container}")
rescue Exception => e rescue Exception => e
Rails.logger.error(e.message) Rails.logger.error(e.message)
end end
end end
if myshixun_manager
zip_path = Gitlab.endpoint.to_s + "/projects/" + myshixun.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token.to_s
container = container.merge(:zip_path => zip_path)
end
# 区分选择题和编程题st0编程题 # 区分选择题和编程题st0编程题
if st == 0 if st == 0

Loading…
Cancel
Save