From 441b0a52aac0493f27c7af8938d7d560ce76f384 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 22 Jan 2019 14:42:11 +0800 Subject: [PATCH] 1 --- chapter2/mysite/myapp/static/scripts/index.js | 19 +++++++++++ .../mysite/myapp/templates/myapp/crawl.html | 34 ++++++++++--------- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/chapter2/mysite/myapp/static/scripts/index.js b/chapter2/mysite/myapp/static/scripts/index.js index cb24aa9..c66f226 100755 --- a/chapter2/mysite/myapp/static/scripts/index.js +++ b/chapter2/mysite/myapp/static/scripts/index.js @@ -2,6 +2,25 @@ var symptomName = last_month_day(); $(function(){ + //更新抓取信息 + $.ajax('/myapp/api/crawl_info.json').done(function(data){ + console.log(data); + $('#crawl_info_total_count').html(data.total_count); + $('#crawl_info_today_count').html(data.today_total_count); + $('#crawl_info_product_count').html(data.product_count); + $('#crawl_info_today_product_count').html(data.today_product_count); + $('#crawl_info_comment_count').html(data.comment_count); + $('#crawl_info_today_comment_count').html(data.today_comment_count); + }); + + $.ajax('/myapp/api/platform_info.json').done(function(data){ + $('#disk_freed').html(data.disk_freed+'G'); + $('#disk_used').html(data.disk_used+'G'); + $('#mem_free').html(data.mem_free+'G'); + $('#mem_used').html(data.mem_used+'G'); + $('#tasks_count').html(data.tasks); + }); + init(); init2(); diff --git a/chapter2/mysite/myapp/templates/myapp/crawl.html b/chapter2/mysite/myapp/templates/myapp/crawl.html index 6abf16a..bcb19c5 100644 --- a/chapter2/mysite/myapp/templates/myapp/crawl.html +++ b/chapter2/mysite/myapp/templates/myapp/crawl.html @@ -54,14 +54,14 @@

总采集数据量(条)

-

{{ crawl_info.total_count }}

+

{{ crawl_info.total_count }}

当天采集数据量(条)

-

{{ crawl_info.today_total_count }}

+

{{ crawl_info.today_total_count }}

@@ -70,14 +70,14 @@

商品采集总数(条)

-

{{ crawl_info.product_count }}

+

{{ crawl_info.product_count }}

当天商品采集(条)

-

{{ crawl_info.today_product_count }}

+

{{ crawl_info.today_product_count }}

@@ -87,14 +87,14 @@

评论采集总量(条)

-

{{ crawl_info.comment_count }}

+

{{ crawl_info.comment_count }}

当天评论采集(条)

-

{{ crawl_info.today_comment_count }}

+

{{ crawl_info.today_comment_count }}

@@ -103,35 +103,37 @@
-
cpu用量
-

-
-
-
各商品采集数据量
+
服务器状态
  • 存储空间
    - {{platform_info.disk_freed}}G -

    {{platform_info.disk_used}}G

    + {{platform_info.disk_freed}}G +

    {{platform_info.disk_used}}G

  • 内存占用
    - {{platform_info.mem_free|to_g}}G -

    {{platform_info.mem_used|to_g}}G

    + {{platform_info.mem_free|to_g}}G +

    {{platform_info.mem_used|to_g}}G

  • 进程数
    -

    {{platform_info.tasks}}

    +

    {{platform_info.tasks}}

  • +
    + +
    cpu用量
    +

    + +