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 }}
商品采集总数(条)
-{{ crawl_info.product_count }}
+{{ crawl_info.product_count }}
当天商品采集(条)
-{{ crawl_info.today_product_count }}
+{{ crawl_info.today_product_count }}
评论采集总量(条)
-{{ crawl_info.comment_count }}
+{{ crawl_info.comment_count }}
当天评论采集(条)
-{{ crawl_info.today_comment_count }}
+{{ crawl_info.today_comment_count }}
{{platform_info.disk_used}}G
+ {{platform_info.disk_freed}}G +{{platform_info.disk_used}}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}}