|
|
|
@ -772,7 +772,7 @@ class ShixunsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
# jupyter开启挑战
|
|
|
|
|
def jupyter_exec
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
if is_shixun_opening?
|
|
|
|
|
tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
|
|
|
|
end
|
|
|
|
@ -786,22 +786,23 @@ class ShixunsController < ApplicationController
|
|
|
|
|
commit_id = commit["id"]
|
|
|
|
|
cloud_bridge = edu_setting('cloud_bridge')
|
|
|
|
|
myshixun_identifier = generate_identifier Myshixun, 10
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
@myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier,
|
|
|
|
|
modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
|
|
|
|
|
onclick_time: Time.now, commit_id: commit_id)
|
|
|
|
|
# fork仓库
|
|
|
|
|
project_fork(@myshixun, @repo_path, current_user.login)
|
|
|
|
|
rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
|
|
|
|
|
uri = "#{cloud_bridge}/bridge/game/openGameInstance"
|
|
|
|
|
params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
|
|
|
|
|
interface_post uri, params, 83, "服务器出现问题,请重置环境"
|
|
|
|
|
begin
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
@myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier,
|
|
|
|
|
modify_time: @shixun.modify_time, reset_time: @shixun.reset_time,
|
|
|
|
|
onclick_time: Time.now, commit_id: commit_id)
|
|
|
|
|
# fork仓库
|
|
|
|
|
project_fork(@myshixun, @repo_path, current_user.login)
|
|
|
|
|
rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path)
|
|
|
|
|
uri = "#{cloud_bridge}/bridge/game/openGameInstance"
|
|
|
|
|
params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last}
|
|
|
|
|
interface_post uri, params, 83, "服务器出现问题,请重置环境"
|
|
|
|
|
end
|
|
|
|
|
rescue => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception("服务器出现问题,请重置环境")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
rescue => e
|
|
|
|
|
uid_logger_error(e.message)
|
|
|
|
|
tip_exception(e.message)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def publish
|
|
|
|
|