From 3c0214ffe6b7cf6c2028948e65001bf88e8b660e Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 3 Mar 2020 22:15:33 +0800 Subject: [PATCH 1/4] =?UTF-8?q?get=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/dashboards_controller.rb | 2 +- app/controllers/application_controller.rb | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) 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 From 4e57ae45c8e938f0173d26528ffb2e69491256c3 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 3 Mar 2020 22:17:33 +0800 Subject: [PATCH 2/4] get --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b023e42d9..b7a74cbc1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -453,7 +453,7 @@ class ApplicationController < ActionController::Base begin uid_logger_dubug("--uri_exec: url is #{uri}") uri = URI.parse(URI.encode(uri.strip)) - res = Net::HTTP.get(uri).body + res = Net::HTTP.get(uri) uid_logger_dubug("--uri_exec: .....res is #{res}") res = JSON.parse(res) if (res && res['code'] != 0) From 4b8ecaf38f947aafcd3660daa09cd0b2e40b30e4 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 3 Mar 2020 22:23:10 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/dashboards_controller.rb | 10 +++--- app/views/admins/dashboards/index.html.erb | 32 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index e879a9c14..00ff8234b 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -8,11 +8,11 @@ class Admins::DashboardsController < Admins::BaseController shixun_tomcat = edu_setting('cloud_bridge') - uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo" - res = interface_get uri, 502, "数据接口延迟" - if res['code'] == 0 - @pod_num = res['sum'] || 0 - end + # uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo" + # res = interface_get uri, 502, "数据接口延迟" + # if res['code'] == 0 + # @pod_num = res['sum'] || 0 + # end end def month_active_user diff --git a/app/views/admins/dashboards/index.html.erb b/app/views/admins/dashboards/index.html.erb index 896b12a2f..f864b8ed0 100644 --- a/app/views/admins/dashboards/index.html.erb +++ b/app/views/admins/dashboards/index.html.erb @@ -65,33 +65,35 @@ -
-
当前在线用户数
- <%= UserOnline.count %> +
30天内新增用户数
+ <%= @new_user_count %>
- +
- + + + +
-
+
-
当前Pod总数
- <%= @pod_num.to_i %> +
当前在线用户数
+ <%= UserOnline.count %>
@@ -104,27 +106,25 @@
-
+
-
30天内新增用户数
- <%= @new_user_count %> +
当前Pod总数
+ <%#= @pod_num.to_i %>
- +
- - - - +
+
From 9460ec77edfdac6d6481eba22bb4be5b4d231ca5 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 3 Mar 2020 22:24:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD--=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/dashboards_controller.rb | 10 +++++----- app/views/admins/dashboards/index.html.erb | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index 00ff8234b..e879a9c14 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -8,11 +8,11 @@ class Admins::DashboardsController < Admins::BaseController shixun_tomcat = edu_setting('cloud_bridge') - # uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo" - # res = interface_get uri, 502, "数据接口延迟" - # if res['code'] == 0 - # @pod_num = res['sum'] || 0 - # end + uri = "#{shixun_tomcat}/bridge/monitor/getPodsInfo" + res = interface_get uri, 502, "数据接口延迟" + if res['code'] == 0 + @pod_num = res['sum'] || 0 + end end def month_active_user diff --git a/app/views/admins/dashboards/index.html.erb b/app/views/admins/dashboards/index.html.erb index f864b8ed0..b463e5571 100644 --- a/app/views/admins/dashboards/index.html.erb +++ b/app/views/admins/dashboards/index.html.erb @@ -112,7 +112,7 @@
当前Pod总数
- <%#= @pod_num.to_i %> + <%= @pod_num.to_i %>