diff --git a/app/controllers/jupyters_controller.rb b/app/controllers/jupyters_controller.rb index 988cef01a..6cc78536a 100644 --- a/app/controllers/jupyters_controller.rb +++ b/app/controllers/jupyters_controller.rb @@ -80,4 +80,17 @@ class JupytersController < ApplicationController render json: {status: 0} end + def timeinfo_with_tpm + shixun = Shixun.find_by(identifier: params[:identifier]) + info = jupyter_timeinfo_tpm(shixun) + render json: {status: 0}.merge(info) + end + + def timeinfo_with_tpi + myshixun = Myshixun.find_by(identifier: params[:identifier]) + info = jupyter_timeinfo_tpi(shixun) + render json: {status: 0}.merge(info) + end + + end diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 0e9ba477a..255c0f42e 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -376,7 +376,7 @@ class MyshixunsController < ApplicationController # todo: identifier 是以前的密码,用来验证的,新版如果不需要,和中间层协调更改. params = {tpiID: "#{@myshixun.try(:id)}", tpiGitURL: "#{git_myshixun_url}", tpmGitURL: "#{git_shixun_url}", identifier: "xinhu1ji2qu3"} - uri = "#{shixun_tomcat}/bridge/game/resetTpmRepository" + uri = "#{shixun_tomcat}/bridge/game/resetJupyterTpm" res = uri_post uri, params if (res && res['code'] != 0) tip_exception("实训云平台繁忙(繁忙等级:95)") diff --git a/app/services/jupyter_service.rb b/app/services/jupyter_service.rb index bff9b5dc6..29f54cb02 100644 --- a/app/services/jupyter_service.rb +++ b/app/services/jupyter_service.rb @@ -213,4 +213,27 @@ module JupyterService _jupyter_active(tpiID) end + def _jupyter_timeinfo(tpiID) + shixun_tomcat = edu_setting('cloud_bridge') + uri = "#{shixun_tomcat}/bridge/jupyter/getTimeInfo" + params = {:tpiID => tpiID} + res = uri_post uri, params + if res && res['code'].to_i != 0 + raise("实训云平台繁忙(繁忙等级:130)") + end + + res['data'] + end + + # 获取时间参数 + def jupyter_timeinfo_tpm(shixun) + tpiID = "tpm#{shixun.id}" + _jupyter_timeinfo(tpiID) + end + + # 获取时间参数 + def jupyter_timeinfo_tpi(myshixun) + tpiID = myshixun.id + _jupyter_timeinfo(tpiID) + end end diff --git a/bin/bundle b/bin/bundle old mode 100644 new mode 100755 diff --git a/bin/rails b/bin/rails old mode 100644 new mode 100755 diff --git a/bin/rake b/bin/rake old mode 100644 new mode 100755 diff --git a/bin/setup b/bin/setup old mode 100644 new mode 100755 diff --git a/bin/update b/bin/update old mode 100644 new mode 100755 diff --git a/bin/yarn b/bin/yarn old mode 100644 new mode 100755 diff --git a/config/routes.rb b/config/routes.rb index 45bd13680..7a68ed5e2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -35,6 +35,8 @@ Rails.application.routes.draw do get :reset_with_tpm get :active_with_tpm get :active_with_tpi + get :timeinfo_with_tpm + get :timeinfo_with_tpi post :import_with_tpm end