From a0c3e827bb9118d42eec455db4e37729fba2d408 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 7 Aug 2017 15:56:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8C=96=E5=8F=91=E5=B8=83=E5=AE=9E?= =?UTF-8?q?=E8=AE=AD=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 31 +++++++-------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 407b7a76d..494862132 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -232,31 +232,16 @@ class ShixunsController < ApplicationController # jenkins回调脚本 # gameID 及实训ID def publish - shixun_tomcat = Redmine::Configuration['shixun_tomcat'] begin - gameInfo = @shixun.gameInfo - uri = URI("#{shixun_tomcat}/bridge/game/publishGame") - logger.info(gameInfo) - params = {gameInfo:gameInfo} - logger.info(params) - res = uri_exec uri, params - logger.info("###################{res['code']}") - if res && res['code'].to_i == 0 - logger.info("1111###################{res['code']}") - @shixun.update_attributes(:status => 1) - apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first - if apply && apply.status == 0 - @status = 0 - else - ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0) - notes = User.current.show_name.to_s + " 申请发布实训:#{@shixun.name}" - JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) - @status = 1 - end - shixun_modify_status_without_publish(@shixun, 1) + @shixun.update_attributes!(:status => 1) + apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first + if apply && apply.status == 0 + @status = 0 else - logger.error("res['code'] is #{res['code']}, res['msg'] is #{res['code']}") - @jenkin_error = true + ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => User.current.id, :status => 0) + notes = User.current.show_name.to_s + " 申请发布实训:#{@shixun.name}" + JournalsForMessage.create(:jour_id => 1, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0) + @status = 1 end rescue Exception => e @jenkin_error = true