From d2138f41bd9f0e3bbfa175830cb0f4a9f3ee199b Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 28 Sep 2017 19:27:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 2 +- app/helpers/application_helper.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 4320fc635..375596075 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -260,7 +260,7 @@ class ChallengesController < ApplicationController end end # 向jenkins端发送请求,构建公共测试用例 - shixun_modify_status_without_publish(@shixun, 1) + shixun_modify_status_publish(@shixun, 1) elsif params[:tab].to_i == 5 @challenge_tags.delete_all unless @challenge_tags.blank? unless params[:knowledge].blank? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d8e58790d..122d74478 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -101,6 +101,17 @@ module ApplicationHelper shixun_modify_status_without_publish shixun, type end + def shixun_modify_status_publish shixun, type + shixun_tomcat = Redmine::Configuration['shixun_tomcat'] + gameInfo = shixun.gameInfo + uri ="#{shixun_tomcat}/bridge/game/publishGame" + params = {gameInfo:gameInfo} + res = uri_exec uri, params + if res && res['code'].to_i != 0 + raise("实训云平台繁忙(繁忙等级:90)") + end + end + # 仅仅产生记录,用于已执行publish的方法 # ShixunModify中status 1:表示有更改,开启实训的时候需要重置,0:表示不需要重置或已重置完成 def shixun_modify_status_without_publish shixun, type