From 456fb54d6e0af5ce19370e3f471e790023ddddf1 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 30 May 2019 11:22:15 +0800 Subject: [PATCH] pull --- app/controllers/myshixuns_controller.rb | 4 ++++ app/services/games_service.rb | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 802bb8b9..96f45d3a 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -10,6 +10,10 @@ class MyshixunsController < ApplicationController include ApplicationHelper + def archive + + end + def forbidden render_403 return diff --git a/app/services/games_service.rb b/app/services/games_service.rb index a53ee086..af1ce935 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -77,6 +77,23 @@ class GamesService :image_url => image_url, :user_url => user_url, :praise_count => praise_count, :user_praise => user_praise, :time_limit => time_limit, :tomcat_url => Redmine::Configuration['tomcat_php'], :is_teacher => is_teacher, :power => power, :myshixun_manager => myshixun_manager, :vnc => shixun.vnc} + if shixun.vnc + begin + shixun_tomcat = Redmine::Configuration['shixun_tomcat'] + service_host = Redmine::Configuration['tomcat_php'] + uri = "#{shixun_tomcat}/bridge/vnc/getvnc" + params = {tpiID: myshixun.id, :containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}"} + res = uri_exec uri, params + if res && res['code'].to_i != 0 + raise("实训云平台繁忙(繁忙等级:99)") + end + url = service_host +":#{res['port']}/vnc.html" + rescue Exception => e + logger.error(e.message) + end + container = container.merge(:vnc_url => url) + end + # 区分选择题和编程题,st:0编程题; if st == 0