diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index 15be92b99..e879a9c14 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -9,7 +9,7 @@ class Admins::DashboardsController < Admins::BaseController shixun_tomcat = edu_setting('cloud_bridge') uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo" - res = interface_post uri, params, 502, "数据接口延迟" + res = interface_get uri, 502, "数据接口延迟" if res['code'] == 0 @pod_num = res['sum'] || 0 end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b9d50a970..b023e42d9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -448,6 +448,25 @@ class ApplicationController < ActionController::Base end end + # 无参类型处理 + def interface_get(uri, status, message) + begin + uid_logger_dubug("--uri_exec: url is #{uri}") + uri = URI.parse(URI.encode(uri.strip)) + res = Net::HTTP.get(uri).body + uid_logger_dubug("--uri_exec: .....res is #{res}") + res = JSON.parse(res) + if (res && res['code'] != 0) + tip_exception(status, message) + else + res + end + rescue Exception => e + uid_logger("--uri_exec: exception #{e.message}") + raise Educoder::TipException.new(message) + end + end + # json格式请求 def interface_json_post(uri, params, status, message) begin