简化发布实训代码
This commit is contained in:
parent
63ce126282
commit
a0c3e827bb
|
|
@ -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 + " 申请发布实训:<a href='#{shixun_path(@shixun)}'>#{@shixun.name}</a>"
|
||||
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 + " 申请发布实训:<a href='#{shixun_path(@shixun)}'>#{@shixun.name}</a>"
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue