diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb index 774caad9..b5e9df62 100644 --- a/app/models/myshixun.rb +++ b/app/models/myshixun.rb @@ -15,7 +15,8 @@ class Myshixun < ActiveRecord::Base belongs_to :user validates_uniqueness_of :shixun_id, :scope => :user_id, :message => "error" # 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)} def output_times diff --git a/app/services/games_service.rb b/app/services/games_service.rb index af1ce935..f09e2dcf 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -45,7 +45,7 @@ class GamesService # 高性能取上一关、下一关 prev_game = Game.prev_identifier(shixun.id, game.myshixun_id, game_challenge.position) - next_game = if current_user.is_certification_teacher || shixun_manager(shixun, current_user) || game.status || shixun.task_pass + next_game = if shixun.vnc || current_user.is_certification_teacher || shixun_manager(shixun, current_user) || game.status || shixun.task_pass Game.next_game(shixun.id, game.myshixun_id, game_challenge.position).try(:identifier) end @@ -87,13 +87,19 @@ class GamesService if res && res['code'].to_i != 0 raise("实训云平台繁忙(繁忙等级:99)") end - url = service_host +":#{res['port']}/vnc.html" + url = service_host +":#{res['port']}/vnc_lite.html" + Rails.logger.info("66666666sssssss#{url}") + container = container.merge(:vnc_url => url) + Rails.logger.info("777777666sssssss#{container}") rescue Exception => e - logger.error(e.message) + Rails.logger.error(e.message) end - container = container.merge(:vnc_url => url) 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 # 区分选择题和编程题,st:0编程题; if st == 0