|
|
|
@ -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
|
|
|
|
|