|  |  | @ -17,7 +17,7 @@ class ShixunsController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  | 																								 :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] |  |  |  | 																								 :get_mirror_script, :download_file, :shixun_list, :batch_send_to_course] | 
			
		
	
		
		
			
				
					
					|  |  |  | 	before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file] |  |  |  | 	before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file] | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	before_action :allowed, only:  [:update, :close, :update_propaedeutics, :settings, :publish, |  |  |  | 	before_action :allowed, only:  [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 																  :shixun_members_added, :change_manager, :collaborators_delete, |  |  |  | 																  :shixun_members_added, :change_manager, :collaborators_delete, | 
			
		
	
		
		
			
				
					
					|  |  |  | 																	:cancel_apply_public, :cancel_publish, :add_collaborators, :add_file] |  |  |  | 																	:cancel_apply_public, :cancel_publish, :add_collaborators, :add_file] | 
			
		
	
		
		
			
				
					
					|  |  |  | 	before_action :portion_allowed, only: [:copy] |  |  |  | 	before_action :portion_allowed, only: [:copy] | 
			
		
	
	
		
		
			
				
					|  |  | @ -839,25 +839,25 @@ class ShixunsController < ApplicationController | 
			
		
	
		
		
			
				
					
					|  |  |  | 				end |  |  |  | 				end | 
			
		
	
		
		
			
				
					
					|  |  |  | 			end |  |  |  | 			end | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if @status == 0 |  |  |  | 			if @status == 0 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				ActiveRecord::Base.transaction do |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 				@shixun.update_attributes!(:status => 2) |  |  |  | 				@shixun.update_attributes!(:status => 2) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		rescue Exception => e | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			logger.error("pushlish game #{e}") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	end | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	def apply_public | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		tip_exception(-1, "请先发布实训再申请公开") if @shixun.status != 2 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		ActiveRecord::Base.transaction do | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			@shixun.update_attributes!(pubic: 1) | 
			
		
	
		
		
			
				
					
					|  |  |  | 			apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first |  |  |  | 			apply = ApplyAction.where(:container_type => "ApplyShixun", :container_id => @shixun.id).order("created_at desc").first | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if apply && apply.status == 0 |  |  |  | 			if apply && apply.status == 0 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				@status = 0 |  |  |  | 				@status = 0 | 
			
		
	
		
		
			
				
					
					|  |  |  | 			else |  |  |  | 			else | 
			
		
	
		
		
			
				
					
					|  |  |  | 				ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => current_user.id, :status => 0) |  |  |  | 				ApplyAction.create(:container_type => "ApplyShixun", :container_id => @shixun.id, :user_id => current_user.id, :status => 0) | 
			
		
	
		
		
			
				
					
					|  |  |  | 						#begin |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 						#	status = Trustie::Sms.send(mobile: '18711011226', send_type:'publish_shixun' , name: '管理员') |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 						#rescue => e |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 						#	Rails.logger.error "发送验证码出错: #{e}" |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 						#end |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 						@status = 1 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 					end |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 			end |  |  |  | 			end | 
			
		
	
		
		
			
				
					
					|  |  |  | 		end |  |  |  | 		end | 
			
		
	
		
		
			
				
					
					|  |  |  | 		rescue Exception => e |  |  |  | 		normal_status(0, "申请成功") | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			logger.error("pushlish game #{e}") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		end |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	end |  |  |  | 	end | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	# 设置私密版本库的在tpm中的目录 |  |  |  | 	# 设置私密版本库的在tpm中的目录 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |