|
|
|
@ -365,6 +365,31 @@ class MyshixunsController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def sync_code
|
|
|
|
|
shixun_tomcat = edu_setting('cloud_bridge')
|
|
|
|
|
begin
|
|
|
|
|
git_myshixun_url = repo_ip_url @myshixun.repo_path
|
|
|
|
|
git_shixun_url = repo_ip_url @myshixun.shixun.try(:repo_path)
|
|
|
|
|
git_myshixun_url = Base64.urlsafe_encode64(git_myshixun_url)
|
|
|
|
|
git_shixun_url = Base64.urlsafe_encode64(git_shixun_url)
|
|
|
|
|
# todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改.
|
|
|
|
|
params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}",
|
|
|
|
|
identifier: "xinhu1ji2qu3"}
|
|
|
|
|
uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository"
|
|
|
|
|
res = uri_post uri, params
|
|
|
|
|
if (res && res['code'] != 0)
|
|
|
|
|
tip_exception("实训云平台繁忙(繁忙等级:95)")
|
|
|
|
|
end
|
|
|
|
|
shixun_new_commit = GitService.commits(repo_path: @myshixun.shixun.repo_path).first["id"]
|
|
|
|
|
@myshixun.update_attributes!(commit_id: shixun_new_commit, reset_time: @myshixun.shixun.try(:reset_time))
|
|
|
|
|
# 更新完成后,弹框则隐藏不再提示
|
|
|
|
|
@myshixun.update_column(:system_tip, false)
|
|
|
|
|
render_ok
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
tip_exception("立即更新代码失败!#{e.message}")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -----End
|
|
|
|
|
|
|
|
|
|