From 44e9e65d37a3f23998f0f9d00fd199bd15765d4b Mon Sep 17 00:00:00 2001
From: xieshen <1397910458@qq.com>
Date: Thu, 7 Jan 2021 12:04:02 +0800
Subject: [PATCH] #add message
---
dashboard/models.py | 40 +-
dashboard/templates/dashboard/index.html | 384 ++++--
dashboard/views.py | 13 +-
get_data_for_mysql.py | 16 -
get_data_for_mysql_toutiao_article.py | 52 +
get_data_for_mysql_toutiao_comment.py | 44 +
get_data_for_mysql_weixin_article.py | 46 +
monitor/urls.py | 1 +
monitor/views.py | 1374 +++++++++++++++-------
test.py | 12 +-
替换时间戳_toutiao.py | 40 +
替换时间戳_weixin.py | 41 +
12 files changed, 1465 insertions(+), 598 deletions(-)
delete mode 100644 get_data_for_mysql.py
create mode 100644 get_data_for_mysql_toutiao_article.py
create mode 100644 get_data_for_mysql_toutiao_comment.py
create mode 100644 get_data_for_mysql_weixin_article.py
create mode 100644 替换时间戳_toutiao.py
create mode 100644 替换时间戳_weixin.py
diff --git a/dashboard/models.py b/dashboard/models.py
index 32876be..57b3e32 100644
--- a/dashboard/models.py
+++ b/dashboard/models.py
@@ -420,19 +420,14 @@ class Weixin(NewMedia):
# 微信文章采集
class Weixin_data(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
- title = models.CharField('文章标题', max_length=256, null=True, blank=True)
- site = models.CharField('位置', max_length=256, null=True, blank=True)
- year = models.CharField('年', max_length=256, null=True, blank=True)
- month = models.CharField('月', max_length=256, null=True, blank=True)
- day = models.CharField('日', max_length=256, null=True, blank=True)
- original = models.BooleanField('是否原创', null=True, blank=True)
- url = models.CharField('文章链接', max_length=256, null=True, blank=True)
- author = models.CharField('作者', max_length=256, null=True, blank=True)
- comment = models.CharField('评论数', max_length=256, null=True, blank=True)
- reply = models.CharField('作者回复数', max_length=256, null=True, blank=True)
- content = models.TextField('正文', null=True, blank=True)
weixin = models.ForeignKey(
Weixin, on_delete=models.CASCADE, null=True, blank=True)
+ mp = models.CharField('mp',max_length=256,null=True,blank=True)
+ title = models.CharField('标题',max_length=256,null=True,blank=True)
+ content = models.TextField('content',null=True,blank=True)
+ author = models.CharField('author',max_length=256,null=True,blank=True)
+ timestamp = models.CharField('timestamp',max_length=256,null=True,blank=True)
+ link = models.CharField('link',max_length=2560,null=True,blank=True)
created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True)
@@ -549,16 +544,27 @@ class Toutiao_data(models.Model):
# 今日头条评论
class Toutiao_comment(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
- comment = models.TextField('评论', null=True, blank=True)
- user = models.CharField('用户', max_length=256, null=True, blank=True)
- reply = models.TextField('回复', null=True, blank=True)
- toutiao = models.ForeignKey(
- Toutiao, on_delete=models.CASCADE, null=True, blank=True)
+ # comment = models.TextField('评论', null=True, blank=True)
+ # user = models.CharField('用户', max_length=256, null=True, blank=True)
+ # reply = models.TextField('回复', null=True, blank=True)
+ # toutiao = models.ForeignKey(
+ # Toutiao, on_delete=models.CASCADE, null=True, blank=True)
+
+ type = models.CharField('type',max_length=256,null=True,blank=True)
+ tid = models.CharField('tid',max_length=256,null=True,blank=True)
+ cid = models.CharField('cid',max_length=256,null=True,blank=True)
+ rid = models.CharField('rid',max_length=256,null=True,blank=True)
+ username = models.CharField('username',max_length=256,null=True,blank=True)
+ content = models.TextField('content',null=True,blank=True)
+ time = models.CharField('time',max_length=256,null=True,blank=True)
+ reply_count = models.IntegerField('reply_count',null=True,blank=True)
+ diggcount = models.IntegerField('diggcount',null=True,blank=True)
+
created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True)
def __str__(self):
- return self.user
+ return self.username
# 今日头条错别字
diff --git a/dashboard/templates/dashboard/index.html b/dashboard/templates/dashboard/index.html
index c07f9c5..358fca5 100644
--- a/dashboard/templates/dashboard/index.html
+++ b/dashboard/templates/dashboard/index.html
@@ -7,6 +7,50 @@
crossorigin=""/>
+
+
+
{% endblock %}
{% block content %}
@@ -194,7 +238,7 @@
@@ -202,17 +246,44 @@
-
+
-{#
#}
-{#
更新次数
#}
-{#
#}
-{#
#}
+ {#
#}
+ {#
更新次数
#}
+ {#
#}
+ {#
#}
+
+
+
-
+
@@ -251,128 +322,175 @@
{% endblock %}
\ No newline at end of file
diff --git a/dashboard/views.py b/dashboard/views.py
index 9aba96a..6f4322c 100644
--- a/dashboard/views.py
+++ b/dashboard/views.py
@@ -23,7 +23,7 @@ import datetime
# Create your views here.
from dashboard.models import Userprofile, Organization, Area_code_2020, Weixin, Weibo, Toutiao, Qita, News, Douyin, \
- CheckCode, Group, Group_admin, Group_user, TimelinessMonitoring
+ CheckCode, Group, Group_admin, Group_user, TimelinessMonitoring, Weixin_data
from dashboard.yunpian import YunPian
import os
@@ -50,15 +50,24 @@ def home(request):
def index(request):
+ data = []
weixin_count = Weixin.objects.all().count()
weibo_count = Weibo.objects.all().count()
toutiao_count = Toutiao.objects.all().count()
qita_count = Qita.objects.all().count()
douyin_count = Douyin.objects.all().count()
organization_count = Organization.objects.filter(status='1').count()
+ weixin_data = Weixin_data.objects.all().order_by('-timestamp')[:100]
+ for w in weixin_data:
+ o = dict()
+ o['id'] = str(w.id)
+ o['title'] = w.title
+ o['timestamp'] = w.timestamp
+ o['mp'] = w.mp
+ data.append(o)
return render(request, 'dashboard/index.html',
{'weixin_count': weixin_count, 'weibo_count': weibo_count, 'toutiao_count': toutiao_count,
- 'qita_count': qita_count, 'douyin_count': douyin_count, 'organization_count': organization_count})
+ 'qita_count': qita_count, 'douyin_count': douyin_count, 'organization_count': organization_count,'weixin_data':data})
def user_login(request):
diff --git a/get_data_for_mysql.py b/get_data_for_mysql.py
deleted file mode 100644
index ed080d1..0000000
--- a/get_data_for_mysql.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import pymysql
-
-host = "210.72.82.249"
-user = "pom"
-password = "pomWechat2020"
-port = 3306
-database = 'pomdb'
-mysql = pymysql.connect(host=host,user=user,password=password,port=port,database=database)
-cursor = mysql.cursor()
-
-sql = 'select * from toutiao_article where id = "65226"'
-cursor.execute(sql)
-
-results = cursor.fetchall()
-for r in results:
- print(r)
diff --git a/get_data_for_mysql_toutiao_article.py b/get_data_for_mysql_toutiao_article.py
new file mode 100644
index 0000000..2ec5ed4
--- /dev/null
+++ b/get_data_for_mysql_toutiao_article.py
@@ -0,0 +1,52 @@
+import uuid
+
+import psycopg2
+import pymysql
+
+host = "210.72.82.249"
+user = "pom"
+password = "pomWechat2020"
+port = 3306
+database = 'pomdb'
+mysql = pymysql.connect(host=host,user=user,password=password,port=port,database=database)
+cursor = mysql.cursor()
+G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
+
+
+def insert(toutiao_id, tid, celltype, title, content, time, url, commentcount, readnum, likenum,shownum):
+ try:
+ with psycopg2.connect(G2) as connection:
+ with connection.cursor() as cursor1:
+ cursor1.execute("select * from dashboard_toutiao where toutiaoid = '%s'" % (toutiao_id))
+ r = cursor1.fetchall()
+ for i in r:
+ print(i[9])
+ with connection.cursor() as cursor:
+ id = uuid.uuid4()
+ cursor.execute(
+ "insert into dashboard_toutiao_data(id,toutiao_id, tid, celltype, title, content, time, url, commentcount, readnum, likenum,shownum,created,updated) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,now(),now() )"
+ , (str(id), i[0], tid, celltype, title, content, time, url, commentcount, readnum, likenum,
+ shownum))
+ connection.commit()
+ except:
+ pass
+if __name__ == '__main__':
+ sql = 'select * from toutiao_article'
+ cursor.execute(sql)
+ results = cursor.fetchall()
+ for r in results:
+ print(r)
+ toutiao_id = r[1]
+ tid = r[3]
+ celltype = r[4]
+ title = r[5]
+ content = r[6]
+ time = r[7]
+ url = r[8]
+ commentcount = r[9]
+ readnum = r[10]
+ likenum = r[11]
+ shownum = r[12]
+ insert(toutiao_id, tid, celltype, title, content, time, url, commentcount, readnum, likenum, shownum)
+
+
diff --git a/get_data_for_mysql_toutiao_comment.py b/get_data_for_mysql_toutiao_comment.py
new file mode 100644
index 0000000..2c7fa9f
--- /dev/null
+++ b/get_data_for_mysql_toutiao_comment.py
@@ -0,0 +1,44 @@
+import uuid
+
+import psycopg2
+import pymysql
+
+host = "210.72.82.249"
+user = "pom"
+password = "pomWechat2020"
+port = 3306
+database = 'pomdb'
+mysql = pymysql.connect(host=host,user=user,password=password,port=port,database=database)
+cursor = mysql.cursor()
+G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
+
+
+def insert(type, tid, cid, rid, username, content, time, reply_count, diggcount):
+ try:
+ with psycopg2.connect(G2) as connection:
+ with connection.cursor() as cursor:
+ id = uuid.uuid4()
+ cursor.execute(
+ "insert into dashboard_toutiao_comment(id,type, tid, cid, rid, username, content, time, reply_count, diggcount,created,updated) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,now(),now() )"
+ , (str(id),type, tid, cid, rid, username, content, time, reply_count, diggcount))
+ connection.commit()
+ except:
+ pass
+if __name__ == '__main__':
+ sql = 'select * from toutiao_comment'
+ cursor.execute(sql)
+ results = cursor.fetchall()
+ for r in results:
+ print(r)
+ type = r[1]
+ tid = r[2]
+ cid = r[3]
+ rid = r[4]
+ username = r[5]
+ content = r[6]
+ time = r[7]
+ reply_count = r[8]
+ diggcount = r[9]
+ insert(type, tid, cid, rid, username, content, time, reply_count, diggcount)
+
+
diff --git a/get_data_for_mysql_weixin_article.py b/get_data_for_mysql_weixin_article.py
new file mode 100644
index 0000000..8930e0c
--- /dev/null
+++ b/get_data_for_mysql_weixin_article.py
@@ -0,0 +1,46 @@
+import uuid
+
+import psycopg2
+import pymysql
+
+host = "210.72.82.249"
+user = "pom"
+password = "pomWechat2020"
+port = 3306
+database = 'pomdb'
+mysql = pymysql.connect(host=host,user=user,password=password,port=port,database=database)
+cursor = mysql.cursor()
+G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
+
+
+def insert(mp, title, content, author, timestamp, link,weixin_id):
+ try:
+ with psycopg2.connect(G2) as connection:
+ with connection.cursor() as cursor1:
+ cursor1.execute("select * from dashboard_weixin where weixinid = '%s'" % (weixin_id))
+ r = cursor1.fetchall()
+ for i in r:
+ with connection.cursor() as cursor:
+ id = uuid.uuid4()
+ cursor.execute(
+ "insert into dashboard_weixin_data(id,weixin_id, mp, title, content, author, timestamp, link,created,updated) values (%s,%s,%s,%s,%s,%s,%s,%s,now(),now() )"
+ , (str(id), i[0], mp, title, content, author, timestamp, link))
+ connection.commit()
+ except:
+ pass
+if __name__ == '__main__':
+ sql = 'select * from weixin_article'
+ cursor.execute(sql)
+ results = cursor.fetchall()
+ for r in results:
+ print(r)
+ mp = r[1]
+ title = r[2]
+ content = r[3]
+ author = r[4]
+ timestamp = r[5]
+ link = r[6]
+ weixin_id = str(link).split('biz=')[1].split('&mid')[0]
+ insert(mp, title, content, author, timestamp, link,weixin_id)
+
+
diff --git a/monitor/urls.py b/monitor/urls.py
index 8189c53..7b5e1f4 100644
--- a/monitor/urls.py
+++ b/monitor/urls.py
@@ -35,6 +35,7 @@ urlpatterns = [
path('index/map/',views.index_map,name='index-map'),
path('index/newmedia/count/',views.index_newmedia_count,name='index-newmedia-count'),
path('index/warning/count/',views.index_warning_count,name='index-warning-count'),
+ path('index/update/count/',views.index_update_count,name='index-update-count'),
diff --git a/monitor/views.py b/monitor/views.py
index 11769f7..e5f1ab4 100644
--- a/monitor/views.py
+++ b/monitor/views.py
@@ -1,15 +1,17 @@
import csv
import datetime
import json
+import time
from collections import Counter
import jieba
+from dateutil.relativedelta import relativedelta
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Sum
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render
-from datetime import timedelta,date
+from datetime import timedelta, date
# Create your views here.
from django.views.decorators.csrf import csrf_exempt
@@ -18,6 +20,8 @@ from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita
from monitor.models import Test
import pandas as pd
+
+
@login_required
def new_media_public_opinion_weixin(request):
weixin = Weixin.objects.all()
@@ -38,6 +42,7 @@ def new_media_public_opinion_weixin(request):
return render(request, 'monitor/new-media-public-opinion-weixin.html',
{'res': res, 'weixin': weixin, 'group': group})
+
@login_required
def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all()
@@ -60,6 +65,7 @@ def new_media_public_opinion_toutiao(request):
return render(request, 'monitor/new-media-public-opinion-toutiao.html',
{'res': res, 'toutiao': toutiao, 'group': group})
+
@login_required
def new_media_public_opinion_douyin(request):
douyin = Douyin.objects.all()
@@ -80,6 +86,7 @@ def new_media_public_opinion_douyin(request):
return render(request, 'monitor/new-media-public-opinion-douyin.html',
{'res': res, 'douyin': douyin, 'group': group})
+
@login_required
def new_media_public_opinion_weibo(request):
weibo = Weibo.objects.all()
@@ -101,6 +108,7 @@ def new_media_public_opinion_weibo(request):
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weibo.html', {'res': res, 'weibo': weibo, 'group': group})
+
@login_required
def new_media_public_opinion_qita(request):
qita = Qita.objects.all()
@@ -123,6 +131,7 @@ def new_media_public_opinion_qita(request):
res.append(o)
return render(request, 'monitor/new-media-public-opinion-qita.html', {'res': res, 'qita': qita, 'group': group})
+
@login_required
def timeliness_monitoring_weixin(request):
now = datetime.datetime.now()
@@ -132,7 +141,7 @@ def timeliness_monitoring_weixin(request):
# 本月第一天和最后一天
this_month_start = datetime.datetime(now.year, now.month, 1)
if now.month == 12:
- this_month_end = datetime.datetime(now.year, now.month , 1) - timedelta(days=1) + datetime.timedelta(
+ this_month_end = datetime.datetime(now.year, now.month, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
else:
this_month_end = datetime.datetime(now.year, now.month, 1) - timedelta(days=1) + datetime.timedelta(
@@ -175,7 +184,9 @@ def timeliness_monitoring_weixin(request):
o = dict()
o['n_type'] = t.n_type
o['n_name'] = Weixin.objects.get(identificationcode=t.identificationcode).code
- o['count'] = TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))['nums']
+ o['count'] = \
+ TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))[
+ 'nums']
o['results'] = t.results
o['update'] = t.update
o['silent'] = t.silent
@@ -185,14 +196,18 @@ def timeliness_monitoring_weixin(request):
o['date'] = t.date
o['city'] = Area_code_2020.objects.get(code=t.city).name
o['district'] = Area_code_2020.objects.get(code=t.district).name
- o['wrongly'] = Wrongly.objects.filter(n_name=Weixin.objects.get(identificationcode=t.identificationcode).code).count()
+ o['wrongly'] = Wrongly.objects.filter(
+ n_name=Weixin.objects.get(identificationcode=t.identificationcode).code).count()
res.append(o)
return render(request, 'monitor/timeliness-monitoring-weixin.html',
{'new_media_count': new_media_count, 'new_media_count_month': new_media_count_month,
'new_media_count_week': new_media_count_week, 'wrongly_count': wrongly_count,
- 'organization_count': organization_count, 'update_count': update_count, 'organization_count_month': organization_count_month,
- 'organization_count_week': organization_count_week, 'res': res,'timelinessmonitoring':timelinessmonitoring})
+ 'organization_count': organization_count, 'update_count': update_count,
+ 'organization_count_month': organization_count_month,
+ 'organization_count_week': organization_count_week, 'res': res,
+ 'timelinessmonitoring': timelinessmonitoring})
+
@login_required
def timeliness_monitoring_weibo(request):
@@ -206,7 +221,7 @@ def timeliness_monitoring_weibo(request):
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
else:
- this_month_end = datetime.datetime(now.year, now.month , 1) - timedelta(days=1) + datetime.timedelta(
+ this_month_end = datetime.datetime(now.year, now.month, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
# 新媒体数量
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
@@ -247,7 +262,9 @@ def timeliness_monitoring_weibo(request):
for t in timelinessmonitoring:
o = dict()
o['n_type'] = t.n_type
- o['count'] = TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))['nums']
+ o['count'] = \
+ TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))[
+ 'nums']
o['n_name'] = Weibo.objects.get(identificationcode=t.identificationcode).code
o['results'] = t.results
o['update'] = t.update
@@ -270,6 +287,7 @@ def timeliness_monitoring_weibo(request):
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
+
@login_required
def timeliness_monitoring_toutiao(request):
now = datetime.datetime.now()
@@ -320,7 +338,9 @@ def timeliness_monitoring_toutiao(request):
for t in timelinessmonitoring:
o = dict()
o['n_type'] = t.n_type
- o['count'] = TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))['nums']
+ o['count'] = \
+ TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))[
+ 'nums']
o['n_name'] = Toutiao.objects.get(identificationcode=t.identificationcode).code
o['results'] = t.results
o['update'] = t.update
@@ -343,6 +363,7 @@ def timeliness_monitoring_toutiao(request):
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
+
@login_required
def timeliness_monitoring_douyin(request):
now = datetime.datetime.now()
@@ -355,7 +376,7 @@ def timeliness_monitoring_douyin(request):
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
else:
- this_month_end = datetime.datetime(now.year, now.month , 1) - timedelta(days=1) + datetime.timedelta(
+ this_month_end = datetime.datetime(now.year, now.month, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59)
# 新媒体数量
new_media_count = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
@@ -396,7 +417,9 @@ def timeliness_monitoring_douyin(request):
for t in timelinessmonitoring:
o = dict()
o['n_type'] = t.n_type
- o['count'] = TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))['nums']
+ o['count'] = \
+ TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))[
+ 'nums']
o['n_name'] = Douyin.objects.get(identificationcode=t.identificationcode).code
o['results'] = t.results
o['update'] = t.update
@@ -419,6 +442,7 @@ def timeliness_monitoring_douyin(request):
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
+
@login_required
def timeliness_monitoring_qita(request):
now = datetime.datetime.now()
@@ -457,7 +481,8 @@ def timeliness_monitoring_qita(request):
organization_count_month = Organization.objects.filter(created__range=(this_month_start, this_month_end)).count()
organization_count_week = Organization.objects.filter(created__range=(this_week_start, this_week_end)).count()
- timelinessmonitoring = TimelinessMonitoring.objects.exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).order_by(
+ timelinessmonitoring = TimelinessMonitoring.objects.exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).order_by(
'date')
res = []
@@ -473,11 +498,13 @@ def timeliness_monitoring_qita(request):
for t in timelinessmonitoring:
o = dict()
o['n_type'] = t.n_type
- o['count'] = TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))['nums']
+ o['count'] = \
+ TimelinessMonitoring.objects.filter(identificationcode=t.identificationcode).aggregate(nums=Sum('update'))[
+ 'nums']
try:
o['n_name'] = Qita.objects.get(identificationcode=t.identificationcode).code
except:
- print(str(t.identificationcode)+"6666666666666666666666666666666666666777")
+ print(str(t.identificationcode) + "6666666666666666666666666666666666666777")
o['results'] = t.results
o['update'] = t.update
o['silent'] = t.silent
@@ -492,17 +519,18 @@ def timeliness_monitoring_qita(request):
o['wrongly'] = Wrongly.objects.filter(
n_name=Douyin.objects.get(identificationcode=t.identificationcode).code).count()
except:
- print(str(t.identificationcode)+"111111111111111111111111111111111")
+ print(str(t.identificationcode) + "111111111111111111111111111111111")
res.append(o)
return render(request, 'monitor/timeliness-monitoring-qita.html',
{'new_media_count': new_media_count, 'new_media_count_month': new_media_count_month,
'new_media_count_week': new_media_count_week, 'wrongly_count': wrongly_count,
'organization_count': organization_count, 'update_count': update_count,
- 'organization_count_month': organization_count_month,
+ 'organization_count_month': organization_count_month,
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
+
@login_required
def error_monitoring(request):
wrongly = Wrongly.objects.all()
@@ -514,12 +542,14 @@ def error_monitoring(request):
wrongly = paginator.page(1)
except EmptyPage:
wrongly = paginator.page(paginator.num_pages)
- return render(request, 'monitor/error-monitoring.html',{'wrongly':wrongly})
+ return render(request, 'monitor/error-monitoring.html', {'wrongly': wrongly})
+
@login_required
def sensitive_word_monitoring(request):
- data = range(1,8)
- return render(request, 'monitor/sensitive-word-monitoring.html',{'data':data})
+ data = range(1, 8)
+ return render(request, 'monitor/sensitive-word-monitoring.html', {'data': data})
+
@login_required
def comment_on_interactive_monitoring(request):
@@ -532,7 +562,8 @@ def comment_on_interactive_monitoring(request):
comment = paginator.page(1)
except EmptyPage:
comment = paginator.page(paginator.num_pages)
- return render(request, 'monitor/comment-on-interactive-monitoring.html',{"comment":comment})
+ return render(request, 'monitor/comment-on-interactive-monitoring.html', {"comment": comment})
+
@login_required
def comment_on_interactive_monitoring_json(request):
@@ -560,12 +591,15 @@ def comment_on_interactive_monitoring_json(request):
"res": res
}))
+
@login_required
def monitoring_report(request):
news = News.objects.filter(type='3').order_by('-date')
count = News.objects.filter(type='3').count()
return render(request, 'monitor/monitoring-report.html', {'news': news, 'count': count})
+
+
@login_required
def monitoring_report_json(request):
news = News.objects.filter(type='3').order_by('date')
@@ -580,12 +614,13 @@ def monitoring_report_json(request):
o['year'] = str(n.date).split('-')[0]
o['month'] = str(n.date).split('-')[1]
news_list.append(o)
- return JsonResponse(news_list,safe=False)
+ return JsonResponse(news_list, safe=False)
def test(request):
return render(request, 'monitor/test.html')
+
@login_required
def test_json(request):
res = []
@@ -613,6 +648,7 @@ def test_json(request):
"res": res
}))
+
@login_required
def timeliness_monitoring_json(request):
date = TimelinessMonitoring.objects.distinct('date')
@@ -647,83 +683,126 @@ def timeliness_monitoring_json(request):
linxia_YIELD = []
for d in date:
date_list.append(d.date)
- lanzhou.append(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- jiayuguan.append(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- jinchang.append(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- jiuquan.append(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- zhangye.append(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- wuwei.append(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- baiyin.append(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- tianshui.append(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- pingliang.append(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- qingyang.append(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- dingxi.append(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- longnan.append(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- gannan.append(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- linxia.append(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date).aggregate(nums=Sum('update'))['nums'])
- if TimelinessMonitoring.objects.filter(city='620100000000',date=d.date).count() != 0:
- lanzhou_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620200000000',date=d.date).count() != 0:
- jiayuguan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620300000000',date=d.date).count() != 0:
- jinchang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620900000000',date=d.date).count() != 0:
- jiuquan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620700000000',date=d.date).count() != 0:
- zhangye_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620600000000',date=d.date).count() != 0:
- wuwei_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620400000000',date=d.date).count() != 0:
- baiyin_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620500000000',date=d.date).count() != 0:
- tianshui_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620800000000',date=d.date).count() != 0:
- pingliang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621000000000',date=d.date).count() != 0:
- qingyang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621100000000',date=d.date).count() != 0:
- dingxi_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621200000000',date=d.date).count() != 0:
- longnan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='623000000000',date=d.date).count() != 0:
- gannan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='622900000000',date=d.date).count() != 0:
- linxia_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,results='合格').count())/int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date).count()),2)*100)
+ lanzhou.append(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ jiayuguan.append(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ jinchang.append(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ jiuquan.append(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ zhangye.append(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ wuwei.append(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ baiyin.append(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ tianshui.append(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ pingliang.append(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ qingyang.append(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ dingxi.append(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ longnan.append(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ gannan.append(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ linxia.append(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date).aggregate(nums=Sum('update'))['nums'])
+ if TimelinessMonitoring.objects.filter(city='620100000000', date=d.date).count() != 0:
+ lanzhou_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620200000000', date=d.date).count() != 0:
+ jiayuguan_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620300000000', date=d.date).count() != 0:
+ jinchang_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620900000000', date=d.date).count() != 0:
+ jiuquan_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620700000000', date=d.date).count() != 0:
+ zhangye_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620600000000', date=d.date).count() != 0:
+ wuwei_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620400000000', date=d.date).count() != 0:
+ baiyin_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620500000000', date=d.date).count() != 0:
+ tianshui_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620800000000', date=d.date).count() != 0:
+ pingliang_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621000000000', date=d.date).count() != 0:
+ qingyang_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621100000000', date=d.date).count() != 0:
+ dingxi_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621200000000', date=d.date).count() != 0:
+ longnan_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='623000000000', date=d.date).count() != 0:
+ gannan_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date).count()), 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='622900000000', date=d.date).count() != 0:
+ linxia_YIELD.append(round(
+ int(TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, results='合格').count()) / int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date).count()), 2) * 100)
print(lanzhou_YIELD)
return HttpResponse(json.dumps({
- "status":"1",
- "lanzhou":lanzhou,
- "lanzhou_YIELD":lanzhou_YIELD,
- "jiayuguan":jiayuguan,
- "jiayuguan_YIELD":jiayuguan_YIELD,
- "jinchang":jinchang,
- "jinchang_YIELD":jinchang_YIELD,
- "jiuquan":jiuquan,
- "jiuquan_YIELD":jiuquan_YIELD,
- "zhangye":zhangye,
- "zhangye_YIELD":zhangye_YIELD,
- "wuwei":wuwei,
- "wuwei_YIELD":wuwei_YIELD,
- "baiyin":baiyin,
- "baiyin_YIELD":baiyin_YIELD,
- "tianshui":tianshui,
- "tianshui_YIELD":tianshui_YIELD,
- "pingliang":pingliang,
- "pingliang_YIELD":pingliang_YIELD,
- "qingyang":qingyang,
- "qingyang_YIELD":qingyang_YIELD,
- "dingxi":dingxi,
- "dingxi_YIELD":dingxi_YIELD,
- "longnan":longnan,
- "longnan_YIELD":longnan_YIELD,
- "gannan":gannan,
- "gannan_YIELD":gannan_YIELD,
- "linxia":linxia,
- "linxia_YIELD":linxia_YIELD,
- "date":date_list,
+ "status": "1",
+ "lanzhou": lanzhou,
+ "lanzhou_YIELD": lanzhou_YIELD,
+ "jiayuguan": jiayuguan,
+ "jiayuguan_YIELD": jiayuguan_YIELD,
+ "jinchang": jinchang,
+ "jinchang_YIELD": jinchang_YIELD,
+ "jiuquan": jiuquan,
+ "jiuquan_YIELD": jiuquan_YIELD,
+ "zhangye": zhangye,
+ "zhangye_YIELD": zhangye_YIELD,
+ "wuwei": wuwei,
+ "wuwei_YIELD": wuwei_YIELD,
+ "baiyin": baiyin,
+ "baiyin_YIELD": baiyin_YIELD,
+ "tianshui": tianshui,
+ "tianshui_YIELD": tianshui_YIELD,
+ "pingliang": pingliang,
+ "pingliang_YIELD": pingliang_YIELD,
+ "qingyang": qingyang,
+ "qingyang_YIELD": qingyang_YIELD,
+ "dingxi": dingxi,
+ "dingxi_YIELD": dingxi_YIELD,
+ "longnan": longnan,
+ "longnan_YIELD": longnan_YIELD,
+ "gannan": gannan,
+ "gannan_YIELD": gannan_YIELD,
+ "linxia": linxia,
+ "linxia_YIELD": linxia_YIELD,
+ "date": date_list,
}))
+
@login_required
def timeliness_monitoring_json_weixin(request):
date = TimelinessMonitoring.objects.distinct('date')
@@ -759,95 +838,166 @@ def timeliness_monitoring_json_weixin(request):
for d in date:
date_list.append(d.date)
lanzhou.append(
- TimelinessMonitoring.objects.filter(city='620100000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
jiayuguan.append(
- TimelinessMonitoring.objects.filter(city='620200000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
jinchang.append(
- TimelinessMonitoring.objects.filter(city='620300000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
jiuquan.append(
- TimelinessMonitoring.objects.filter(city='620900000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
zhangye.append(
- TimelinessMonitoring.objects.filter(city='620700000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
wuwei.append(
- TimelinessMonitoring.objects.filter(city='620600000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
baiyin.append(
- TimelinessMonitoring.objects.filter(city='620400000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
tianshui.append(
- TimelinessMonitoring.objects.filter(city='620500000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
pingliang.append(
- TimelinessMonitoring.objects.filter(city='620800000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
qingyang.append(
- TimelinessMonitoring.objects.filter(city='621000000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
dingxi.append(
- TimelinessMonitoring.objects.filter(city='621100000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
longnan.append(
- TimelinessMonitoring.objects.filter(city='621200000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
gannan.append(
- TimelinessMonitoring.objects.filter(city='623000000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
linxia.append(
- TimelinessMonitoring.objects.filter(city='622900000000', date=d.date,n_type__contains='微信').aggregate(nums=Sum('update'))['nums'])
- if TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,n_type__contains='微信').count() != 0:
- lanzhou_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,n_type__contains='微信').count() != 0:
- jiayuguan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,n_type__contains='微信').count() != 0:
- jinchang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,n_type__contains='微信').count() != 0:
- jiuquan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,n_type__contains='微信').count() != 0:
- zhangye_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,n_type__contains='微信').count() != 0:
- wuwei_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,n_type__contains='微信').count() != 0:
- baiyin_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,n_type__contains='微信').count() != 0:
- tianshui_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,n_type__contains='微信').count() != 0:
- pingliang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,n_type__contains='微信').count() != 0:
- qingyang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,n_type__contains='微信').count() != 0:
- dingxi_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,n_type__contains='微信').count() != 0:
- longnan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,n_type__contains='微信').count() != 0:
- gannan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,n_type__contains='微信').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,n_type__contains='微信').count() != 0:
- linxia_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,results='合格',n_type__contains='微信').count())/int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,n_type__contains='微信').count()),2)*100)
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='微信').aggregate(
+ nums=Sum('update'))['nums'])
+ if TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='微信').count() != 0:
+ lanzhou_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='微信').count() != 0:
+ jiayuguan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='微信').count() != 0:
+ jinchang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='微信').count() != 0:
+ jiuquan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='微信').count() != 0:
+ zhangye_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='微信').count() != 0:
+ wuwei_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='微信').count() != 0:
+ baiyin_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='微信').count() != 0:
+ tianshui_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='微信').count() != 0:
+ pingliang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='微信').count() != 0:
+ qingyang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='微信').count() != 0:
+ dingxi_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='微信').count() != 0:
+ longnan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='微信').count() != 0:
+ gannan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='微信').count() != 0:
+ linxia_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, results='合格',
+ n_type__contains='微信').count()) / int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='微信').count()),
+ 2) * 100)
return HttpResponse(json.dumps({
- "status":"1",
- "lanzhou":lanzhou,
- "lanzhou_YIELD":lanzhou_YIELD,
- "jiayuguan":jiayuguan,
- "jiayuguan_YIELD":jiayuguan_YIELD,
- "jinchang":jinchang,
- "jinchang_YIELD":jinchang_YIELD,
- "jiuquan":jiuquan,
- "jiuquan_YIELD":jiuquan_YIELD,
- "zhangye":zhangye,
- "zhangye_YIELD":zhangye_YIELD,
- "wuwei":wuwei,
- "wuwei_YIELD":wuwei_YIELD,
- "baiyin":baiyin,
- "baiyin_YIELD":baiyin_YIELD,
- "tianshui":tianshui,
- "tianshui_YIELD":tianshui_YIELD,
- "pingliang":pingliang,
- "pingliang_YIELD":pingliang_YIELD,
- "qingyang":qingyang,
- "qingyang_YIELD":qingyang_YIELD,
- "dingxi":dingxi,
- "dingxi_YIELD":dingxi_YIELD,
- "longnan":longnan,
- "longnan_YIELD":longnan_YIELD,
- "gannan":gannan,
- "gannan_YIELD":gannan_YIELD,
- "linxia":linxia,
- "linxia_YIELD":linxia_YIELD,
- "date":date_list,
+ "status": "1",
+ "lanzhou": lanzhou,
+ "lanzhou_YIELD": lanzhou_YIELD,
+ "jiayuguan": jiayuguan,
+ "jiayuguan_YIELD": jiayuguan_YIELD,
+ "jinchang": jinchang,
+ "jinchang_YIELD": jinchang_YIELD,
+ "jiuquan": jiuquan,
+ "jiuquan_YIELD": jiuquan_YIELD,
+ "zhangye": zhangye,
+ "zhangye_YIELD": zhangye_YIELD,
+ "wuwei": wuwei,
+ "wuwei_YIELD": wuwei_YIELD,
+ "baiyin": baiyin,
+ "baiyin_YIELD": baiyin_YIELD,
+ "tianshui": tianshui,
+ "tianshui_YIELD": tianshui_YIELD,
+ "pingliang": pingliang,
+ "pingliang_YIELD": pingliang_YIELD,
+ "qingyang": qingyang,
+ "qingyang_YIELD": qingyang_YIELD,
+ "dingxi": dingxi,
+ "dingxi_YIELD": dingxi_YIELD,
+ "longnan": longnan,
+ "longnan_YIELD": longnan_YIELD,
+ "gannan": gannan,
+ "gannan_YIELD": gannan_YIELD,
+ "linxia": linxia,
+ "linxia_YIELD": linxia_YIELD,
+ "date": date_list,
}))
+
@login_required
def timeliness_monitoring_json_weibo(request):
date = TimelinessMonitoring.objects.distinct('date')
@@ -924,70 +1074,125 @@ def timeliness_monitoring_json_weibo(request):
linxia.append(
TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='微博').aggregate(
nums=Sum('update'))['nums'])
- if TimelinessMonitoring.objects.filter(city='620100000000',date=d.date, n_type__contains='微博').count() != 0:
- lanzhou_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620200000000',date=d.date, n_type__contains='微博').count() != 0:
- jiayuguan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620300000000',date=d.date, n_type__contains='微博').count() != 0:
- jinchang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620900000000',date=d.date, n_type__contains='微博').count() != 0:
- jiuquan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620700000000',date=d.date, n_type__contains='微博').count() != 0:
- zhangye_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620600000000',date=d.date, n_type__contains='微博').count() != 0:
- wuwei_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620400000000',date=d.date, n_type__contains='微博').count() != 0:
- baiyin_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620500000000',date=d.date, n_type__contains='微博').count() != 0:
- tianshui_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620800000000',date=d.date, n_type__contains='微博').count() != 0:
- pingliang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621000000000',date=d.date, n_type__contains='微博').count() != 0:
- qingyang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621100000000',date=d.date, n_type__contains='微博').count() != 0:
- dingxi_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621200000000',date=d.date, n_type__contains='微博').count() != 0:
- longnan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='623000000000',date=d.date, n_type__contains='微博').count() != 0:
- gannan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,n_type__contains='微博').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='622900000000',date=d.date, n_type__contains='微博').count() != 0:
- linxia_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,results='合格',n_type__contains='微博').count())/int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,n_type__contains='微博').count()),2)*100)
-
-
+ if TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='微博').count() != 0:
+ lanzhou_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='微博').count() != 0:
+ jiayuguan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='微博').count() != 0:
+ jinchang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='微博').count() != 0:
+ jiuquan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='微博').count() != 0:
+ zhangye_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='微博').count() != 0:
+ wuwei_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='微博').count() != 0:
+ baiyin_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='微博').count() != 0:
+ tianshui_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='微博').count() != 0:
+ pingliang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='微博').count() != 0:
+ qingyang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='微博').count() != 0:
+ dingxi_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='微博').count() != 0:
+ longnan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='微博').count() != 0:
+ gannan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='微博').count() != 0:
+ linxia_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, results='合格',
+ n_type__contains='微博').count()) / int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='微博').count()),
+ 2) * 100)
return HttpResponse(json.dumps({
- "status":"1",
- "lanzhou":lanzhou,
- "lanzhou_YIELD":lanzhou_YIELD,
- "jiayuguan":jiayuguan,
- "jiayuguan_YIELD":jiayuguan_YIELD,
- "jinchang":jinchang,
- "jinchang_YIELD":jinchang_YIELD,
- "jiuquan":jiuquan,
- "jiuquan_YIELD":jiuquan_YIELD,
- "zhangye":zhangye,
- "zhangye_YIELD":zhangye_YIELD,
- "wuwei":wuwei,
- "wuwei_YIELD":wuwei_YIELD,
- "baiyin":baiyin,
- "baiyin_YIELD":baiyin_YIELD,
- "tianshui":tianshui,
- "tianshui_YIELD":tianshui_YIELD,
- "pingliang":pingliang,
- "pingliang_YIELD":pingliang_YIELD,
- "qingyang":qingyang,
- "qingyang_YIELD":qingyang_YIELD,
- "dingxi":dingxi,
- "dingxi_YIELD":dingxi_YIELD,
- "longnan":longnan,
- "longnan_YIELD":longnan_YIELD,
- "gannan":gannan,
- "gannan_YIELD":gannan_YIELD,
- "linxia":linxia,
- "linxia_YIELD":linxia_YIELD,
- "date":date_list,
+ "status": "1",
+ "lanzhou": lanzhou,
+ "lanzhou_YIELD": lanzhou_YIELD,
+ "jiayuguan": jiayuguan,
+ "jiayuguan_YIELD": jiayuguan_YIELD,
+ "jinchang": jinchang,
+ "jinchang_YIELD": jinchang_YIELD,
+ "jiuquan": jiuquan,
+ "jiuquan_YIELD": jiuquan_YIELD,
+ "zhangye": zhangye,
+ "zhangye_YIELD": zhangye_YIELD,
+ "wuwei": wuwei,
+ "wuwei_YIELD": wuwei_YIELD,
+ "baiyin": baiyin,
+ "baiyin_YIELD": baiyin_YIELD,
+ "tianshui": tianshui,
+ "tianshui_YIELD": tianshui_YIELD,
+ "pingliang": pingliang,
+ "pingliang_YIELD": pingliang_YIELD,
+ "qingyang": qingyang,
+ "qingyang_YIELD": qingyang_YIELD,
+ "dingxi": dingxi,
+ "dingxi_YIELD": dingxi_YIELD,
+ "longnan": longnan,
+ "longnan_YIELD": longnan_YIELD,
+ "gannan": gannan,
+ "gannan_YIELD": gannan_YIELD,
+ "linxia": linxia,
+ "linxia_YIELD": linxia_YIELD,
+ "date": date_list,
}))
+
@login_required
def timeliness_monitoring_json_toutiao(request):
date = TimelinessMonitoring.objects.distinct('date')
@@ -1064,68 +1269,125 @@ def timeliness_monitoring_json_toutiao(request):
linxia.append(
TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='头条').aggregate(
nums=Sum('update'))['nums'])
- if TimelinessMonitoring.objects.filter(city='620100000000',date=d.date, n_type__contains='头条').count() != 0:
- lanzhou_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620200000000',date=d.date, n_type__contains='头条').count() != 0:
- jiayuguan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620300000000',date=d.date, n_type__contains='头条').count() != 0:
- jinchang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620900000000',date=d.date, n_type__contains='头条').count() != 0:
- jiuquan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620700000000',date=d.date, n_type__contains='头条').count() != 0:
- zhangye_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620600000000',date=d.date, n_type__contains='头条').count() != 0:
- wuwei_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620400000000',date=d.date, n_type__contains='头条').count() != 0:
- baiyin_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620500000000',date=d.date, n_type__contains='头条').count() != 0:
- tianshui_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620800000000',date=d.date, n_type__contains='头条').count() != 0:
- pingliang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621000000000',date=d.date, n_type__contains='头条').count() != 0:
- qingyang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621100000000',date=d.date, n_type__contains='头条').count() != 0:
- dingxi_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621200000000',date=d.date, n_type__contains='头条').count() != 0:
- longnan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='623000000000',date=d.date, n_type__contains='头条').count() != 0:
- gannan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,n_type__contains='头条').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='622900000000',date=d.date, n_type__contains='头条').count() != 0:
- linxia_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,results='合格',n_type__contains='头条').count())/int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,n_type__contains='头条').count()),2)*100)
+ if TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='头条').count() != 0:
+ lanzhou_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='头条').count() != 0:
+ jiayuguan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='头条').count() != 0:
+ jinchang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='头条').count() != 0:
+ jiuquan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='头条').count() != 0:
+ zhangye_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='头条').count() != 0:
+ wuwei_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='头条').count() != 0:
+ baiyin_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='头条').count() != 0:
+ tianshui_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='头条').count() != 0:
+ pingliang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='头条').count() != 0:
+ qingyang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='头条').count() != 0:
+ dingxi_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='头条').count() != 0:
+ longnan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='头条').count() != 0:
+ gannan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='头条').count() != 0:
+ linxia_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, results='合格',
+ n_type__contains='头条').count()) / int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='头条').count()),
+ 2) * 100)
return HttpResponse(json.dumps({
- "status":"1",
- "lanzhou":lanzhou,
- "lanzhou_YIELD":lanzhou_YIELD,
- "jiayuguan":jiayuguan,
- "jiayuguan_YIELD":jiayuguan_YIELD,
- "jinchang":jinchang,
- "jinchang_YIELD":jinchang_YIELD,
- "jiuquan":jiuquan,
- "jiuquan_YIELD":jiuquan_YIELD,
- "zhangye":zhangye,
- "zhangye_YIELD":zhangye_YIELD,
- "wuwei":wuwei,
- "wuwei_YIELD":wuwei_YIELD,
- "baiyin":baiyin,
- "baiyin_YIELD":baiyin_YIELD,
- "tianshui":tianshui,
- "tianshui_YIELD":tianshui_YIELD,
- "pingliang":pingliang,
- "pingliang_YIELD":pingliang_YIELD,
- "qingyang":qingyang,
- "qingyang_YIELD":qingyang_YIELD,
- "dingxi":dingxi,
- "dingxi_YIELD":dingxi_YIELD,
- "longnan":longnan,
- "longnan_YIELD":longnan_YIELD,
- "gannan":gannan,
- "gannan_YIELD":gannan_YIELD,
- "linxia":linxia,
- "linxia_YIELD":linxia_YIELD,
- "date":date_list,
+ "status": "1",
+ "lanzhou": lanzhou,
+ "lanzhou_YIELD": lanzhou_YIELD,
+ "jiayuguan": jiayuguan,
+ "jiayuguan_YIELD": jiayuguan_YIELD,
+ "jinchang": jinchang,
+ "jinchang_YIELD": jinchang_YIELD,
+ "jiuquan": jiuquan,
+ "jiuquan_YIELD": jiuquan_YIELD,
+ "zhangye": zhangye,
+ "zhangye_YIELD": zhangye_YIELD,
+ "wuwei": wuwei,
+ "wuwei_YIELD": wuwei_YIELD,
+ "baiyin": baiyin,
+ "baiyin_YIELD": baiyin_YIELD,
+ "tianshui": tianshui,
+ "tianshui_YIELD": tianshui_YIELD,
+ "pingliang": pingliang,
+ "pingliang_YIELD": pingliang_YIELD,
+ "qingyang": qingyang,
+ "qingyang_YIELD": qingyang_YIELD,
+ "dingxi": dingxi,
+ "dingxi_YIELD": dingxi_YIELD,
+ "longnan": longnan,
+ "longnan_YIELD": longnan_YIELD,
+ "gannan": gannan,
+ "gannan_YIELD": gannan_YIELD,
+ "linxia": linxia,
+ "linxia_YIELD": linxia_YIELD,
+ "date": date_list,
}))
+
@login_required
def timeliness_monitoring_json_douyin(request):
date = TimelinessMonitoring.objects.distinct('date')
@@ -1202,68 +1464,125 @@ def timeliness_monitoring_json_douyin(request):
linxia.append(
TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='抖音').aggregate(
nums=Sum('update'))['nums'])
- if TimelinessMonitoring.objects.filter(city='620100000000',date=d.date, n_type__contains='抖音').count() != 0:
- lanzhou_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620200000000',date=d.date, n_type__contains='抖音').count() != 0:
- jiayuguan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620300000000',date=d.date, n_type__contains='抖音').count() != 0:
- jinchang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620900000000',date=d.date, n_type__contains='抖音').count() != 0:
- jiuquan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620700000000',date=d.date, n_type__contains='抖音').count() != 0:
- zhangye_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620600000000',date=d.date, n_type__contains='抖音').count() != 0:
- wuwei_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620400000000',date=d.date, n_type__contains='抖音').count() != 0:
- baiyin_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620500000000',date=d.date, n_type__contains='抖音').count() != 0:
- tianshui_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620800000000',date=d.date, n_type__contains='抖音').count() != 0:
- pingliang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621000000000',date=d.date, n_type__contains='抖音').count() != 0:
- qingyang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621100000000',date=d.date, n_type__contains='抖音').count() != 0:
- dingxi_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621200000000',date=d.date, n_type__contains='抖音').count() != 0:
- longnan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='623000000000',date=d.date, n_type__contains='抖音').count() != 0:
- gannan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,n_type__contains='抖音').count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='622900000000',date=d.date, n_type__contains='抖音').count() != 0:
- linxia_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,results='合格',n_type__contains='抖音').count())/int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,n_type__contains='抖音').count()),2)*100)
+ if TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='抖音').count() != 0:
+ lanzhou_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='抖音').count() != 0:
+ jiayuguan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='抖音').count() != 0:
+ jinchang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='抖音').count() != 0:
+ jiuquan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='抖音').count() != 0:
+ zhangye_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='抖音').count() != 0:
+ wuwei_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='抖音').count() != 0:
+ baiyin_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='抖音').count() != 0:
+ tianshui_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='抖音').count() != 0:
+ pingliang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='抖音').count() != 0:
+ qingyang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='抖音').count() != 0:
+ dingxi_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='抖音').count() != 0:
+ longnan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='抖音').count() != 0:
+ gannan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='抖音').count() != 0:
+ linxia_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, results='合格',
+ n_type__contains='抖音').count()) / int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, n_type__contains='抖音').count()),
+ 2) * 100)
return HttpResponse(json.dumps({
- "status":"1",
- "lanzhou":lanzhou,
- "lanzhou_YIELD":lanzhou_YIELD,
- "jiayuguan":jiayuguan,
- "jiayuguan_YIELD":jiayuguan_YIELD,
- "jinchang":jinchang,
- "jinchang_YIELD":jinchang_YIELD,
- "jiuquan":jiuquan,
- "jiuquan_YIELD":jiuquan_YIELD,
- "zhangye":zhangye,
- "zhangye_YIELD":zhangye_YIELD,
- "wuwei":wuwei,
- "wuwei_YIELD":wuwei_YIELD,
- "baiyin":baiyin,
- "baiyin_YIELD":baiyin_YIELD,
- "tianshui":tianshui,
- "tianshui_YIELD":tianshui_YIELD,
- "pingliang":pingliang,
- "pingliang_YIELD":pingliang_YIELD,
- "qingyang":qingyang,
- "qingyang_YIELD":qingyang_YIELD,
- "dingxi":dingxi,
- "dingxi_YIELD":dingxi_YIELD,
- "longnan":longnan,
- "longnan_YIELD":longnan_YIELD,
- "gannan":gannan,
- "gannan_YIELD":gannan_YIELD,
- "linxia":linxia,
- "linxia_YIELD":linxia_YIELD,
- "date":date_list,
+ "status": "1",
+ "lanzhou": lanzhou,
+ "lanzhou_YIELD": lanzhou_YIELD,
+ "jiayuguan": jiayuguan,
+ "jiayuguan_YIELD": jiayuguan_YIELD,
+ "jinchang": jinchang,
+ "jinchang_YIELD": jinchang_YIELD,
+ "jiuquan": jiuquan,
+ "jiuquan_YIELD": jiuquan_YIELD,
+ "zhangye": zhangye,
+ "zhangye_YIELD": zhangye_YIELD,
+ "wuwei": wuwei,
+ "wuwei_YIELD": wuwei_YIELD,
+ "baiyin": baiyin,
+ "baiyin_YIELD": baiyin_YIELD,
+ "tianshui": tianshui,
+ "tianshui_YIELD": tianshui_YIELD,
+ "pingliang": pingliang,
+ "pingliang_YIELD": pingliang_YIELD,
+ "qingyang": qingyang,
+ "qingyang_YIELD": qingyang_YIELD,
+ "dingxi": dingxi,
+ "dingxi_YIELD": dingxi_YIELD,
+ "longnan": longnan,
+ "longnan_YIELD": longnan_YIELD,
+ "gannan": gannan,
+ "gannan_YIELD": gannan_YIELD,
+ "linxia": linxia,
+ "linxia_YIELD": linxia_YIELD,
+ "date": date_list,
}))
+
@login_required
def timeliness_monitoring_json_qita(request):
date = TimelinessMonitoring.objects.distinct('date')
@@ -1299,109 +1618,208 @@ def timeliness_monitoring_json_qita(request):
for d in date:
date_list.append(d.date)
lanzhou.append(
- TimelinessMonitoring.objects.filter(city='620100000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
jiayuguan.append(
- TimelinessMonitoring.objects.filter(city='620200000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
jinchang.append(
- TimelinessMonitoring.objects.filter(city='620300000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
jiuquan.append(
- TimelinessMonitoring.objects.filter(city='620900000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
zhangye.append(
- TimelinessMonitoring.objects.filter(city='620700000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
wuwei.append(
- TimelinessMonitoring.objects.filter(city='620600000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
baiyin.append(
- TimelinessMonitoring.objects.filter(city='620400000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
tianshui.append(
- TimelinessMonitoring.objects.filter(city='620500000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
pingliang.append(
- TimelinessMonitoring.objects.filter(city='620800000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
qingyang.append(
- TimelinessMonitoring.objects.filter(city='621000000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
dingxi.append(
- TimelinessMonitoring.objects.filter(city='621100000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
longnan.append(
- TimelinessMonitoring.objects.filter(city='621200000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
gannan.append(
- TimelinessMonitoring.objects.filter(city='623000000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
linxia.append(
- TimelinessMonitoring.objects.filter(city='622900000000', date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).aggregate(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).aggregate(
nums=Sum('update'))['nums'])
- if TimelinessMonitoring.objects.filter(city='620100000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- lanzhou_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620100000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620200000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- jiayuguan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620200000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620300000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- jinchang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620300000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620900000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- jiuquan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620900000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620700000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- zhangye_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620700000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620600000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- wuwei_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620600000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620400000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- baiyin_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620400000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620500000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- tianshui_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620500000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='620800000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- pingliang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='620800000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621000000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- qingyang_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='621000000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621100000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- dingxi_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='621100000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='621200000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- longnan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='621200000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='623000000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- gannan_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='623000000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
- if TimelinessMonitoring.objects.filter(city='622900000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count() != 0:
- linxia_YIELD.append(round(int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date,results='合格').exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count())/int(TimelinessMonitoring.objects.filter(city='622900000000',date=d.date).exclude(n_type__in=['微信', '微博', '今日头条', '抖音','微信订阅号','新浪微博','微信服务号','抖音短视频','小程序+微信']).count()),2)*100)
+ if TimelinessMonitoring.objects.filter(city='620100000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ lanzhou_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620100000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620200000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ jiayuguan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620200000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620300000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ jinchang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620300000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620900000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ jiuquan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620900000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620700000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ zhangye_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620700000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620600000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ wuwei_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620600000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620400000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ baiyin_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620400000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620500000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ tianshui_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620500000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='620800000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ pingliang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='620800000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621000000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ qingyang_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='621000000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621100000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ dingxi_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='621100000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='621200000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ longnan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='621200000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='623000000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ gannan_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='623000000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
+ if TimelinessMonitoring.objects.filter(city='622900000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count() != 0:
+ linxia_YIELD.append(round(int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date, results='合格').exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()) / int(
+ TimelinessMonitoring.objects.filter(city='622900000000', date=d.date).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音', '微信订阅号', '新浪微博', '微信服务号', '抖音短视频', '小程序+微信']).count()),
+ 2) * 100)
return HttpResponse(json.dumps({
- "status":"1",
- "lanzhou":lanzhou,
- "lanzhou_YIELD":lanzhou_YIELD,
- "jiayuguan":jiayuguan,
- "jiayuguan_YIELD":jiayuguan_YIELD,
- "jinchang":jinchang,
- "jinchang_YIELD":jinchang_YIELD,
- "jiuquan":jiuquan,
- "jiuquan_YIELD":jiuquan_YIELD,
- "zhangye":zhangye,
- "zhangye_YIELD":zhangye_YIELD,
- "wuwei":wuwei,
- "wuwei_YIELD":wuwei_YIELD,
- "baiyin":baiyin,
- "baiyin_YIELD":baiyin_YIELD,
- "tianshui":tianshui,
- "tianshui_YIELD":tianshui_YIELD,
- "pingliang":pingliang,
- "pingliang_YIELD":pingliang_YIELD,
- "qingyang":qingyang,
- "qingyang_YIELD":qingyang_YIELD,
- "dingxi":dingxi,
- "dingxi_YIELD":dingxi_YIELD,
- "longnan":longnan,
- "longnan_YIELD":longnan_YIELD,
- "gannan":gannan,
- "gannan_YIELD":gannan_YIELD,
- "linxia":linxia,
- "linxia_YIELD":linxia_YIELD,
- "date":date_list,
+ "status": "1",
+ "lanzhou": lanzhou,
+ "lanzhou_YIELD": lanzhou_YIELD,
+ "jiayuguan": jiayuguan,
+ "jiayuguan_YIELD": jiayuguan_YIELD,
+ "jinchang": jinchang,
+ "jinchang_YIELD": jinchang_YIELD,
+ "jiuquan": jiuquan,
+ "jiuquan_YIELD": jiuquan_YIELD,
+ "zhangye": zhangye,
+ "zhangye_YIELD": zhangye_YIELD,
+ "wuwei": wuwei,
+ "wuwei_YIELD": wuwei_YIELD,
+ "baiyin": baiyin,
+ "baiyin_YIELD": baiyin_YIELD,
+ "tianshui": tianshui,
+ "tianshui_YIELD": tianshui_YIELD,
+ "pingliang": pingliang,
+ "pingliang_YIELD": pingliang_YIELD,
+ "qingyang": qingyang,
+ "qingyang_YIELD": qingyang_YIELD,
+ "dingxi": dingxi,
+ "dingxi_YIELD": dingxi_YIELD,
+ "longnan": longnan,
+ "longnan_YIELD": longnan_YIELD,
+ "gannan": gannan,
+ "gannan_YIELD": gannan_YIELD,
+ "linxia": linxia,
+ "linxia_YIELD": linxia_YIELD,
+ "date": date_list,
}))
+
@login_required
def index_map(request):
name = request.GET.get('name').split('市')[0]
@@ -1414,19 +1832,21 @@ def index_map(request):
timelinessmonitoring_douyin = \
TimelinessMonitoring.objects.filter(city__contains=name, n_type='抖音').aggregate(nums=Sum('update'))['nums']
timelinessmonitoring_qita = \
- TimelinessMonitoring.objects.filter(city__contains=name).exclude(n_type__in=['微信', '微博', '今日头条', '抖音']).aggregate(
+ TimelinessMonitoring.objects.filter(city__contains=name).exclude(
+ n_type__in=['微信', '微博', '今日头条', '抖音']).aggregate(
nums=Sum('update'))['nums']
return HttpResponse(json.dumps({
- "status":"1",
- "timelinessmonitoring_weixin":timelinessmonitoring_weixin,
- "timelinessmonitoring_weibo":timelinessmonitoring_weibo,
- "timelinessmonitoring_toutiao":timelinessmonitoring_toutiao,
- "timelinessmonitoring_douyin":timelinessmonitoring_douyin,
- "timelinessmonitoring_qita":timelinessmonitoring_qita,
+ "status": "1",
+ "timelinessmonitoring_weixin": timelinessmonitoring_weixin,
+ "timelinessmonitoring_weibo": timelinessmonitoring_weibo,
+ "timelinessmonitoring_toutiao": timelinessmonitoring_toutiao,
+ "timelinessmonitoring_douyin": timelinessmonitoring_douyin,
+ "timelinessmonitoring_qita": timelinessmonitoring_qita,
}))
+
def index_newmedia_count(request):
- date_list = [x.strftime('%Y-%m-%d') for x in list(pd.date_range(start='2020-09-01',end=datetime.datetime.now()))]
+ date_list = [x.strftime('%Y-%m-%d') for x in list(pd.date_range(start='2020-09-01', end=datetime.datetime.now()))]
weixin_list = []
weibo_list = []
toutiao_list = []
@@ -1434,25 +1854,27 @@ def index_newmedia_count(request):
qita_list = []
for d in date_list:
s = str(d).split('-')
- weixin = Weixin.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
+ weixin = Weixin.objects.filter(created__year=s[0], created__month=s[1], created__day=s[2]).count()
weixin_list.append(weixin)
- weibo = Weibo.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
+ weibo = Weibo.objects.filter(created__year=s[0], created__month=s[1], created__day=s[2]).count()
weibo_list.append(weibo)
- toutiao = Toutiao.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
+ toutiao = Toutiao.objects.filter(created__year=s[0], created__month=s[1], created__day=s[2]).count()
toutiao_list.append(toutiao)
- douyin = Douyin.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
+ douyin = Douyin.objects.filter(created__year=s[0], created__month=s[1], created__day=s[2]).count()
douyin_list.append(douyin)
- qita = Qita.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
+ qita = Qita.objects.filter(created__year=s[0], created__month=s[1], created__day=s[2]).count()
qita_list.append(qita)
return HttpResponse(json.dumps({
- "status":"1",
- "date_list":date_list,
- "weixin":weixin_list,
- "weibo":weibo_list,
- "toutiao":toutiao_list,
- "douyin":douyin_list,
- "qita":qita_list,
+ "status": "1",
+ "date_list": date_list,
+ "weixin": weixin_list,
+ "weibo": weibo_list,
+ "toutiao": toutiao_list,
+ "douyin": douyin_list,
+ "qita": qita_list,
}))
+
+
def index_warning_count(request):
# date_list = [x.strftime('%Y-%m-%d') for x in list(pd.date_range(start='2019-07-01',end=datetime.datetime.now()))]
# data = []
@@ -1469,9 +1891,89 @@ def index_warning_count(request):
news = News.objects.filter(type='3', date=str(d.date)).count()
data.append(news)
return HttpResponse(json.dumps({
- "status":"1",
- "data":data,
- "date_list":date_list
+ "status": "1",
+ "data": data,
+ "date_list": date_list
}))
+def index_update_count(request):
+ # date_list = [x.strftime('%Y-%m-%d') for x in list(pd.date_range(start=datetime.date.today() - relativedelta(months=+2), end=datetime.datetime.now()))]
+ date_list = [x.strftime('%Y-%m-%d') for x in list(pd.date_range(start='2020-01-01', end=datetime.datetime.now()))]
+ date_list.reverse()
+ lanzhou = []
+ jiayuguan = []
+ jinchang = []
+ jiuquan = []
+ zhangye = []
+ wuwei = []
+ baiyin = []
+ tianshui = []
+ pingliang = []
+ qingyang = []
+ dingxi = []
+ longnan = []
+ gannan = []
+ linxia = []
+ for d in date_list[:30]:
+ weixin_lanzhou = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620100000000').count()
+ toutiao_lanzhou = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620100000000').count()
+ lanzhou.append(weixin_lanzhou+toutiao_lanzhou)
+ weixin_jiayuguan = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620200000000').count()
+ toutiao_jiayuguan = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620200000000').count()
+ jiayuguan.append(weixin_jiayuguan+toutiao_jiayuguan)
+ weixin_jinchang = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620300000000').count()
+ toutiao_jinchang = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620300000000').count()
+ jinchang.append(weixin_jinchang+toutiao_jinchang)
+ weixin_jiuquan = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620900000000').count()
+ toutiao_jiuquan = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620900000000').count()
+ jiuquan.append(weixin_jiuquan+toutiao_jiuquan)
+ weixin_zhangye = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620700000000').count()
+ toutiao_zhangye = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620700000000').count()
+ zhangye.append(weixin_zhangye+toutiao_zhangye)
+ weixin_wuwei = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620600000000').count()
+ toutiao_wuwei = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620600000000').count()
+ wuwei.append(weixin_wuwei+toutiao_wuwei)
+ weixin_baiyin = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620400000000').count()
+ toutiao_baiyin = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620400000000').count()
+ baiyin.append(weixin_baiyin+toutiao_baiyin)
+ weixin_tianshui = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620500000000').count()
+ toutiao_tianshui = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620500000000').count()
+ tianshui.append(weixin_tianshui+toutiao_tianshui)
+ weixin_pingliang = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='620800000000').count()
+ toutiao_pingliang = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='620800000000').count()
+ pingliang.append(weixin_pingliang+toutiao_pingliang)
+ weixin_qingyang = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='621000000000').count()
+ toutiao_qingyang = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='621000000000').count()
+ qingyang.append(weixin_qingyang+toutiao_qingyang)
+ weixin_dingxi = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='621100000000').count()
+ toutiao_dingxi = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='621100000000').count()
+ dingxi.append(weixin_dingxi+toutiao_dingxi)
+ weixin_longnan = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='621200000000').count()
+ toutiao_longnan = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='621200000000').count()
+ longnan.append(weixin_longnan+toutiao_longnan)
+ weixin_linxia = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='622900000000').count()
+ toutiao_linxia = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='622900000000').count()
+ linxia.append(weixin_linxia+toutiao_linxia)
+ weixin_gannan = Weixin_data.objects.filter(timestamp=d,weixin__organization__cities='623000000000').count()
+ toutiao_gannan = Toutiao_data.objects.filter(time=d,toutiao__organization__cities='623000000000').count()
+ gannan.append(weixin_gannan+toutiao_gannan)
+
+ return HttpResponse(json.dumps({
+ "status": "1",
+ "lanzhou": lanzhou,
+ "jiayuguan": jiayuguan,
+ "jinchang": jinchang,
+ "jiuquan": jiuquan,
+ "zhangye": zhangye,
+ "wuwei": wuwei,
+ "baiyin": baiyin,
+ "tianshui": tianshui,
+ "pingliang": pingliang,
+ "qingyang": qingyang,
+ "dingxi": dingxi,
+ "longnan": longnan,
+ "gannan": gannan,
+ "linxia": linxia,
+ "date": date_list[:30],
+ }))
diff --git a/test.py b/test.py
index ef1bb8c..bdf7496 100644
--- a/test.py
+++ b/test.py
@@ -1,4 +1,8 @@
-import re
-s = '2020-10-9'
-mat = re.search(r"(\d{4}-\d{1,2}-\d{1,2})",s)
-print(mat)
\ No newline at end of file
+# import re
+# s = '2020-10-9'
+# mat = re.search(r"(\d{4}-\d{1,2}-\d{1,2})",s)
+# print(mat)
+import time
+
+s = time.strftime('%Y-%m-%d', time.localtime(1598716628))
+print(s)
\ No newline at end of file
diff --git a/替换时间戳_toutiao.py b/替换时间戳_toutiao.py
new file mode 100644
index 0000000..ddd773f
--- /dev/null
+++ b/替换时间戳_toutiao.py
@@ -0,0 +1,40 @@
+import time
+import uuid
+
+import psycopg2
+import pymysql
+
+host = "210.72.82.249"
+user = "pom"
+password = "pomWechat2020"
+port = 3306
+database = 'pomdb'
+mysql = pymysql.connect(host=host,user=user,password=password,port=port,database=database)
+cursor = mysql.cursor()
+G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
+
+
+def update(id, s):
+ # try:
+ with psycopg2.connect(G2) as connection:
+ with connection.cursor() as cursor:
+ cursor.execute(
+ "update dashboard_toutiao_data set time = %s where id = %s"
+ , (s,id))
+ connection.commit()
+ # except:
+ # pass
+if __name__ == '__main__':
+ with psycopg2.connect(G2) as connection:
+ with connection.cursor() as cursor:
+ id = uuid.uuid4()
+ cursor.execute(
+ "select id,time from dashboard_toutiao_data")
+ results = cursor.fetchall()
+ for r in results:
+ id = r[0]
+ s = time.strftime('%Y-%m-%d', time.localtime(int(r[1])))
+ print(id,s)
+ update(id, s)
+
+
diff --git a/替换时间戳_weixin.py b/替换时间戳_weixin.py
new file mode 100644
index 0000000..033c6e5
--- /dev/null
+++ b/替换时间戳_weixin.py
@@ -0,0 +1,41 @@
+import time
+import uuid
+
+import psycopg2
+import pymysql
+
+host = "210.72.82.249"
+user = "pom"
+password = "pomWechat2020"
+port = 3306
+database = 'pomdb'
+mysql = pymysql.connect(host=host,user=user,password=password,port=port,database=database)
+cursor = mysql.cursor()
+G2 = 'host=210.77.68.250 port=5432 dbname=newmediaDB3 user=newmedia password=newmedia2020!@#'
+
+
+def update(id, s):
+ # try:
+ with psycopg2.connect(G2) as connection:
+ with connection.cursor() as cursor:
+ cursor.execute(
+ "update dashboard_weixin_data set timestamp = %s where id = %s"
+ , (s,id))
+ connection.commit()
+ # except:
+ # pass
+if __name__ == '__main__':
+ with psycopg2.connect(G2) as connection:
+ with connection.cursor() as cursor:
+ id = uuid.uuid4()
+ cursor.execute(
+ "select id,timestamp from dashboard_weixin_data")
+ results = cursor.fetchall()
+ for r in results:
+ id = r[0]
+ timestamp = r[1]
+ s = time.strftime('%Y-%m-%d', time.localtime(int(timestamp)))
+ print(id,s)
+ update(id, s)
+
+