2020-10-09 01:42:05 +00:00
import csv
2020-10-23 04:04:33 +00:00
import datetime
2020-10-09 01:42:05 +00:00
import json
2021-01-07 04:04:02 +00:00
import time
2020-10-09 01:42:05 +00:00
from collections import Counter
import jieba
2021-01-07 04:04:02 +00:00
from dateutil . relativedelta import relativedelta
2020-11-03 10:07:53 +00:00
from django . contrib . auth . decorators import login_required
2020-10-28 15:31:17 +00:00
from django . core . paginator import Paginator , PageNotAnInteger , EmptyPage
2020-10-23 04:04:33 +00:00
from django . db . models import Sum
2020-10-30 11:36:22 +00:00
from django . http import HttpResponse , JsonResponse
2020-09-18 06:42:55 +00:00
from django . shortcuts import render
2021-01-07 04:04:02 +00:00
from datetime import timedelta , date
2020-09-18 06:42:55 +00:00
# Create your views here.
2020-11-03 06:51:47 +00:00
from django . views . decorators . csrf import csrf_exempt
2020-09-29 02:48:26 +00:00
from dashboard . models import Weixin , Weixin_data , Toutiao_data , Weibo_data , Qita_jc , Group , Toutiao , Weibo , Qita , \
2021-01-06 07:14:57 +00:00
Douyin , Douyin_data , News , TimelinessMonitoring , Organization , Wrongly , NewMedia , Comment , Area_code_2020
2020-10-09 01:42:05 +00:00
from monitor . models import Test
2020-11-11 01:47:43 +00:00
2020-11-04 03:52:36 +00:00
import pandas as pd
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-18 06:42:55 +00:00
def new_media_public_opinion_weixin ( request ) :
2021-02-06 11:10:00 +00:00
# weixin = Weixin.objects.all()
2020-09-18 06:42:55 +00:00
group = Group . objects . all ( )
2021-02-06 11:10:00 +00:00
weixin_data = Weixin_data . objects . all ( ) [ : 10 ]
2020-09-18 06:42:55 +00:00
res = [ ]
for w in weixin_data :
o = dict ( )
o [ ' id ' ] = str ( w . id )
o [ ' code ' ] = w . weixin . code
2021-02-06 06:50:55 +00:00
o [ ' mp ' ] = w . mp
2020-09-18 06:42:55 +00:00
o [ ' title ' ] = w . title
2021-02-06 06:50:55 +00:00
o [ ' content ' ] = w . content
o [ ' author ' ] = w . author
o [ ' timestamp ' ] = w . timestamp
o [ ' link ' ] = w . link
2020-09-18 06:42:55 +00:00
res . append ( o )
2020-10-19 08:52:51 +00:00
return render ( request , ' monitor/new-media-public-opinion-weixin.html ' ,
2021-02-06 11:10:00 +00:00
{ ' res ' : res , ' group ' : group } )
2020-10-19 08:52:51 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-18 06:42:55 +00:00
def new_media_public_opinion_toutiao ( request ) :
2021-02-06 11:10:00 +00:00
# toutiao = Toutiao.objects.all()
2020-09-18 06:42:55 +00:00
group = Group . objects . all ( )
2021-02-06 11:10:00 +00:00
toutiao_data = Toutiao_data . objects . all ( ) . order_by ( ' -likenum ' ) [ : 10 ]
2020-09-18 06:42:55 +00:00
res = [ ]
for t in toutiao_data :
o = dict ( )
o [ ' id ' ] = str ( t . id )
o [ ' code ' ] = t . toutiao . code
2021-03-28 07:43:18 +00:00
if t . toutiao . image :
o [ ' image ' ] = t . toutiao . image
else :
o [ ' image ' ] = ' toutiao.png '
2020-09-18 06:42:55 +00:00
o [ ' title ' ] = t . title
o [ ' commentcount ' ] = t . commentcount
2021-02-06 11:10:00 +00:00
o [ ' readnum ' ] = t . readnum
o [ ' likenum ' ] = t . likenum
o [ ' shownum ' ] = t . shownum
o [ ' celltype ' ] = t . celltype
2020-09-18 06:42:55 +00:00
res . append ( o )
2020-10-19 08:52:51 +00:00
return render ( request , ' monitor/new-media-public-opinion-toutiao.html ' ,
2021-02-06 11:10:00 +00:00
{ ' res ' : res , ' group ' : group } )
2020-10-19 08:52:51 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-29 02:48:26 +00:00
def new_media_public_opinion_douyin ( request ) :
2021-02-06 11:10:00 +00:00
# douyin = Douyin.objects.all()
2020-09-29 02:48:26 +00:00
group = Group . objects . all ( )
2021-02-06 11:10:00 +00:00
douyin_data = Douyin_data . objects . all ( ) . order_by ( ' -comment ' ) [ : 10 ]
2020-09-29 02:48:26 +00:00
res = [ ]
for d in douyin_data :
o = dict ( )
o [ ' id ' ] = str ( d . id )
o [ ' code ' ] = d . newmedia . code
2021-03-28 07:43:18 +00:00
if d . newmedia . image :
o [ ' image ' ] = d . newmedia . image
else :
o [ ' image ' ] = ' danweimoren.jpg '
2020-09-29 02:48:26 +00:00
o [ ' count ' ] = d . count
o [ ' count_jc ' ] = d . count_jc
o [ ' comment ' ] = d . comment
o [ ' reply ' ] = d . reply
o [ ' date ' ] = d . date
res . append ( o )
2020-10-19 08:52:51 +00:00
return render ( request , ' monitor/new-media-public-opinion-douyin.html ' ,
2021-02-06 11:10:00 +00:00
{ ' res ' : res , ' group ' : group } )
2020-10-19 08:52:51 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-18 06:42:55 +00:00
def new_media_public_opinion_weibo ( request ) :
2021-02-06 11:10:00 +00:00
# weibo = Weibo.objects.all()
2020-09-18 06:42:55 +00:00
group = Group . objects . all ( )
2021-02-06 11:10:00 +00:00
weibo_data = Weibo_data . objects . all ( ) . order_by ( ' -like ' ) [ : 10 ]
2020-09-18 06:42:55 +00:00
res = [ ]
for w in weibo_data :
o = dict ( )
o [ ' id ' ] = str ( w . id )
o [ ' code ' ] = w . weibo . code
2021-03-28 07:43:18 +00:00
if w . weibo . image :
o [ ' image ' ] = w . weibo . image
else :
o [ ' image ' ] = ' weibo.png '
2020-09-18 06:42:55 +00:00
o [ ' title ' ] = w . title
o [ ' like ' ] = w . like
o [ ' transpond ' ] = w . transpond
o [ ' comment ' ] = w . comment
o [ ' year ' ] = w . year
o [ ' month ' ] = w . month
o [ ' day ' ] = w . day
res . append ( o )
2021-02-06 11:10:00 +00:00
return render ( request , ' monitor/new-media-public-opinion-weibo.html ' , { ' res ' : res , ' group ' : group } )
2020-10-19 08:52:51 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-18 06:42:55 +00:00
def new_media_public_opinion_qita ( request ) :
2021-02-06 11:10:00 +00:00
# qita = Qita.objects.all()
2020-09-18 06:42:55 +00:00
group = Group . objects . all ( )
2021-02-06 11:10:00 +00:00
qita_jc = Qita_jc . objects . all ( ) . order_by ( ' -comment ' ) [ : 10 ]
2020-09-18 06:42:55 +00:00
res = [ ]
for q in qita_jc :
o = dict ( )
o [ ' id ' ] = str ( q . id )
o [ ' type ' ] = q . qita . type
o [ ' name ' ] = q . qita . name
2021-03-28 07:43:18 +00:00
if q . qita . image :
o [ ' image ' ] = q . qita . image
else :
o [ ' image ' ] = ' qita.png '
2020-09-18 06:42:55 +00:00
o [ ' count ' ] = q . count
o [ ' count_jc ' ] = q . count_jc
o [ ' comment ' ] = q . comment
o [ ' reply ' ] = q . reply
o [ ' year ' ] = q . year
o [ ' month ' ] = q . month
o [ ' day ' ] = q . day
res . append ( o )
2021-02-06 11:10:00 +00:00
return render ( request , ' monitor/new-media-public-opinion-qita.html ' , { ' res ' : res , ' group ' : group } )
2020-10-19 08:52:51 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-28 15:31:17 +00:00
def timeliness_monitoring_weixin ( request ) :
2020-10-23 04:04:33 +00:00
now = datetime . datetime . now ( )
# 本周第一天和最后一天
this_week_start = now - timedelta ( days = now . weekday ( ) )
this_week_end = now + timedelta ( days = 6 - now . weekday ( ) )
# 本月第一天和最后一天
this_month_start = datetime . datetime ( now . year , now . month , 1 )
2020-12-05 16:39:07 +00:00
if now . month == 12 :
2021-01-07 04:04:02 +00:00
this_month_end = datetime . datetime ( now . year , now . month , 1 ) - timedelta ( days = 1 ) + datetime . timedelta (
2020-12-05 16:39:07 +00:00
hours = 23 , minutes = 59 , seconds = 59 )
else :
this_month_end = datetime . datetime ( now . year , now . month , 1 ) - timedelta ( days = 1 ) + datetime . timedelta (
hours = 23 , minutes = 59 , seconds = 59 )
2020-10-28 15:31:17 +00:00
# 新媒体数量
new_media_count = int ( Weixin . objects . all ( ) . count ( ) ) + int ( Weibo . objects . all ( ) . count ( ) ) + int (
Toutiao . objects . all ( ) . count ( ) ) + int ( Douyin . objects . all ( ) . count ( ) ) + int ( Qita . objects . all ( ) . count ( ) )
new_media_count_month = int ( Weixin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) )
new_media_count_week = int ( Weixin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) )
# 内容更新次数
update_count = TimelinessMonitoring . objects . all ( ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
wrongly_count = Wrongly . objects . all ( ) . count
sensitive_count = None
organization_count = Organization . objects . all ( ) . count ( )
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 ( )
2021-01-06 07:14:57 +00:00
timelinessmonitoring = TimelinessMonitoring . objects . filter ( n_type__contains = ' 微信 ' ) . order_by ( ' date ' )
2020-10-28 15:31:17 +00:00
res = [ ]
if timelinessmonitoring is not None :
paginator = Paginator ( timelinessmonitoring , 6 )
page = int ( request . GET . get ( ' page ' , 1 ) )
try :
timelinessmonitoring = paginator . page ( page )
except PageNotAnInteger :
timelinessmonitoring = paginator . page ( 1 )
except EmptyPage :
timelinessmonitoring = paginator . page ( paginator . num_pages )
for t in timelinessmonitoring :
o = dict ( )
o [ ' n_type ' ] = t . n_type
2021-01-06 07:14:57 +00:00
o [ ' n_name ' ] = Weixin . objects . get ( identificationcode = t . identificationcode ) . code
2021-01-07 04:04:02 +00:00
o [ ' count ' ] = \
TimelinessMonitoring . objects . filter ( identificationcode = t . identificationcode ) . aggregate ( nums = Sum ( ' update ' ) ) [
' nums ' ]
2020-10-28 15:31:17 +00:00
o [ ' results ' ] = t . results
o [ ' update ' ] = t . update
2021-01-06 07:14:57 +00:00
o [ ' silent ' ] = t . silent
2020-10-28 15:31:17 +00:00
o [ ' start_data ' ] = t . start_data
o [ ' end_data ' ] = t . end_data
2021-01-06 07:14:57 +00:00
o [ ' date_length ' ] = t . date_length
2020-10-28 15:31:17 +00:00
o [ ' date ' ] = t . date
2021-01-06 07:14:57 +00:00
o [ ' city ' ] = Area_code_2020 . objects . get ( code = t . city ) . name
o [ ' district ' ] = Area_code_2020 . objects . get ( code = t . district ) . name
2021-01-07 04:04:02 +00:00
o [ ' wrongly ' ] = Wrongly . objects . filter (
n_name = Weixin . objects . get ( identificationcode = t . identificationcode ) . code ) . count ( )
2020-10-28 15:31:17 +00:00
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 ,
2021-01-07 04:04:02 +00:00
' organization_count ' : organization_count , ' update_count ' : update_count ,
' organization_count_month ' : organization_count_month ,
' organization_count_week ' : organization_count_week , ' res ' : res ,
' timelinessmonitoring ' : timelinessmonitoring } )
2020-10-28 15:31:17 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-28 15:31:17 +00:00
def timeliness_monitoring_weibo ( request ) :
now = datetime . datetime . now ( )
# 本周第一天和最后一天
this_week_start = now - timedelta ( days = now . weekday ( ) )
this_week_end = now + timedelta ( days = 6 - now . weekday ( ) )
# 本月第一天和最后一天
this_month_start = datetime . datetime ( now . year , now . month , 1 )
2020-12-25 00:55:34 +00:00
if now . month != 12 :
this_month_end = datetime . datetime ( now . year , now . month + 1 , 1 ) - timedelta ( days = 1 ) + datetime . timedelta (
hours = 23 , minutes = 59 , seconds = 59 )
else :
2021-01-07 04:04:02 +00:00
this_month_end = datetime . datetime ( now . year , now . month , 1 ) - timedelta ( days = 1 ) + datetime . timedelta (
2020-12-25 00:55:34 +00:00
hours = 23 , minutes = 59 , seconds = 59 )
2020-10-28 15:31:17 +00:00
# 新媒体数量
new_media_count = int ( Weixin . objects . all ( ) . count ( ) ) + int ( Weibo . objects . all ( ) . count ( ) ) + int (
Toutiao . objects . all ( ) . count ( ) ) + int ( Douyin . objects . all ( ) . count ( ) ) + int ( Qita . objects . all ( ) . count ( ) )
new_media_count_month = int ( Weixin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) )
new_media_count_week = int ( Weixin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) )
# 内容更新次数
update_count = TimelinessMonitoring . objects . all ( ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
# update_count_month = TimelinessMonitoring.objects.filter(created__range=(this_month_start,this_month_end)).aggregate(nums=Sum('update'))['nums']
# update_count_week = TimelinessMonitoring.objects.filter(created__range=(this_week_start,this_week_end)).aggregate(nums=Sum('update'))['nums']
wrongly_count = Wrongly . objects . all ( ) . count
sensitive_count = None
organization_count = Organization . objects . all ( ) . count ( )
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 ( )
2021-01-06 07:14:57 +00:00
timelinessmonitoring = TimelinessMonitoring . objects . filter ( n_type__contains = ' 微博 ' ) . order_by ( ' date ' )
2020-10-28 15:31:17 +00:00
res = [ ]
if timelinessmonitoring is not None :
paginator = Paginator ( timelinessmonitoring , 6 )
page = int ( request . GET . get ( ' page ' , 1 ) )
try :
timelinessmonitoring = paginator . page ( page )
except PageNotAnInteger :
timelinessmonitoring = paginator . page ( 1 )
except EmptyPage :
timelinessmonitoring = paginator . page ( paginator . num_pages )
for t in timelinessmonitoring :
o = dict ( )
o [ ' n_type ' ] = t . n_type
2021-01-07 04:04:02 +00:00
o [ ' count ' ] = \
TimelinessMonitoring . objects . filter ( identificationcode = t . identificationcode ) . aggregate ( nums = Sum ( ' update ' ) ) [
' nums ' ]
2021-01-06 07:14:57 +00:00
o [ ' n_name ' ] = Weibo . objects . get ( identificationcode = t . identificationcode ) . code
2020-10-28 15:31:17 +00:00
o [ ' results ' ] = t . results
o [ ' update ' ] = t . update
2021-01-06 07:14:57 +00:00
o [ ' silent ' ] = t . silent
2020-10-28 15:31:17 +00:00
o [ ' start_data ' ] = t . start_data
o [ ' end_data ' ] = t . end_data
2021-01-06 07:14:57 +00:00
o [ ' date_length ' ] = t . date_length
2020-10-28 15:31:17 +00:00
o [ ' date ' ] = t . date
2021-01-06 07:14:57 +00:00
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 = Weibo . objects . get ( identificationcode = t . identificationcode ) . code ) . count ( )
2020-10-28 15:31:17 +00:00
res . append ( o )
return render ( request , ' monitor/timeliness-monitoring-weibo.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 ,
2021-01-06 07:14:57 +00:00
' organization_count_month ' : organization_count_month ,
2020-10-28 15:31:17 +00:00
' organization_count_week ' : organization_count_week , ' res ' : res ,
' timelinessmonitoring ' : timelinessmonitoring } )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-28 15:31:17 +00:00
def timeliness_monitoring_toutiao ( request ) :
now = datetime . datetime . now ( )
# 本周第一天和最后一天
this_week_start = now - timedelta ( days = now . weekday ( ) )
this_week_end = now + timedelta ( days = 6 - now . weekday ( ) )
# 本月第一天和最后一天
this_month_start = datetime . datetime ( now . year , now . month , 1 )
2020-12-25 00:55:34 +00:00
if now . month != 12 :
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 (
hours = 23 , minutes = 59 , seconds = 59 )
2020-10-28 15:31:17 +00:00
# 新媒体数量
new_media_count = int ( Weixin . objects . all ( ) . count ( ) ) + int ( Weibo . objects . all ( ) . count ( ) ) + int (
Toutiao . objects . all ( ) . count ( ) ) + int ( Douyin . objects . all ( ) . count ( ) ) + int ( Qita . objects . all ( ) . count ( ) )
new_media_count_month = int ( Weixin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) )
new_media_count_week = int ( Weixin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) )
# 内容更新次数
update_count = TimelinessMonitoring . objects . all ( ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
wrongly_count = Wrongly . objects . all ( ) . count
sensitive_count = None
organization_count = Organization . objects . all ( ) . count ( )
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 ( )
2020-10-23 04:04:33 +00:00
2021-01-06 07:14:57 +00:00
timelinessmonitoring = TimelinessMonitoring . objects . filter ( n_type__contains = ' 头条 ' ) . order_by ( ' date ' )
2020-10-28 15:31:17 +00:00
res = [ ]
if timelinessmonitoring is not None :
paginator = Paginator ( timelinessmonitoring , 6 )
page = int ( request . GET . get ( ' page ' , 1 ) )
try :
timelinessmonitoring = paginator . page ( page )
except PageNotAnInteger :
timelinessmonitoring = paginator . page ( 1 )
except EmptyPage :
timelinessmonitoring = paginator . page ( paginator . num_pages )
for t in timelinessmonitoring :
o = dict ( )
o [ ' n_type ' ] = t . n_type
2021-01-07 04:04:02 +00:00
o [ ' count ' ] = \
TimelinessMonitoring . objects . filter ( identificationcode = t . identificationcode ) . aggregate ( nums = Sum ( ' update ' ) ) [
' nums ' ]
2021-01-06 07:14:57 +00:00
o [ ' n_name ' ] = Toutiao . objects . get ( identificationcode = t . identificationcode ) . code
2020-10-28 15:31:17 +00:00
o [ ' results ' ] = t . results
o [ ' update ' ] = t . update
2021-01-06 07:14:57 +00:00
o [ ' silent ' ] = t . silent
2020-10-28 15:31:17 +00:00
o [ ' start_data ' ] = t . start_data
o [ ' end_data ' ] = t . end_data
o [ ' date ' ] = t . date
2021-01-06 07:14:57 +00:00
o [ ' date_length ' ] = t . date_length
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 = Toutiao . objects . get ( identificationcode = t . identificationcode ) . code ) . count ( )
2020-10-28 15:31:17 +00:00
res . append ( o )
return render ( request , ' monitor/timeliness-monitoring-toutiao.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 ,
2021-01-06 07:14:57 +00:00
' organization_count_month ' : organization_count_month ,
2020-10-28 15:31:17 +00:00
' organization_count_week ' : organization_count_week , ' res ' : res ,
' timelinessmonitoring ' : timelinessmonitoring } )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-28 15:31:17 +00:00
def timeliness_monitoring_douyin ( request ) :
now = datetime . datetime . now ( )
# 本周第一天和最后一天
this_week_start = now - timedelta ( days = now . weekday ( ) )
this_week_end = now + timedelta ( days = 6 - now . weekday ( ) )
# 本月第一天和最后一天
this_month_start = datetime . datetime ( now . year , now . month , 1 )
2020-12-25 00:55:34 +00:00
if now . month != 12 :
this_month_end = datetime . datetime ( now . year , now . month + 1 , 1 ) - timedelta ( days = 1 ) + datetime . timedelta (
hours = 23 , minutes = 59 , seconds = 59 )
else :
2021-01-07 04:04:02 +00:00
this_month_end = datetime . datetime ( now . year , now . month , 1 ) - timedelta ( days = 1 ) + datetime . timedelta (
2020-12-25 00:55:34 +00:00
hours = 23 , minutes = 59 , seconds = 59 )
2020-10-28 15:31:17 +00:00
# 新媒体数量
new_media_count = int ( Weixin . objects . all ( ) . count ( ) ) + int ( Weibo . objects . all ( ) . count ( ) ) + int (
Toutiao . objects . all ( ) . count ( ) ) + int ( Douyin . objects . all ( ) . count ( ) ) + int ( Qita . objects . all ( ) . count ( ) )
new_media_count_month = int ( Weixin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) )
new_media_count_week = int ( Weixin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) )
# 内容更新次数
update_count = TimelinessMonitoring . objects . all ( ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
# update_count_month = TimelinessMonitoring.objects.filter(created__range=(this_month_start,this_month_end)).aggregate(nums=Sum('update'))['nums']
# update_count_week = TimelinessMonitoring.objects.filter(created__range=(this_week_start,this_week_end)).aggregate(nums=Sum('update'))['nums']
2020-10-23 04:04:33 +00:00
wrongly_count = Wrongly . objects . all ( ) . count
sensitive_count = None
organization_count = Organization . objects . all ( ) . count ( )
2020-10-28 15:31:17 +00:00
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 ( )
2021-01-06 07:14:57 +00:00
timelinessmonitoring = TimelinessMonitoring . objects . filter ( n_type__contains = ' 抖音 ' ) . order_by ( ' date ' )
2020-10-28 15:31:17 +00:00
res = [ ]
if timelinessmonitoring is not None :
paginator = Paginator ( timelinessmonitoring , 6 )
page = int ( request . GET . get ( ' page ' , 1 ) )
try :
timelinessmonitoring = paginator . page ( page )
except PageNotAnInteger :
timelinessmonitoring = paginator . page ( 1 )
except EmptyPage :
timelinessmonitoring = paginator . page ( paginator . num_pages )
for t in timelinessmonitoring :
o = dict ( )
o [ ' n_type ' ] = t . n_type
2021-01-07 04:04:02 +00:00
o [ ' count ' ] = \
TimelinessMonitoring . objects . filter ( identificationcode = t . identificationcode ) . aggregate ( nums = Sum ( ' update ' ) ) [
' nums ' ]
2021-01-06 07:14:57 +00:00
o [ ' n_name ' ] = Douyin . objects . get ( identificationcode = t . identificationcode ) . code
2020-10-28 15:31:17 +00:00
o [ ' results ' ] = t . results
o [ ' update ' ] = t . update
2021-01-06 07:14:57 +00:00
o [ ' silent ' ] = t . silent
2020-10-28 15:31:17 +00:00
o [ ' start_data ' ] = t . start_data
o [ ' end_data ' ] = t . end_data
o [ ' date ' ] = t . date
2021-01-06 07:14:57 +00:00
o [ ' date_length ' ] = t . date_length
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 = Douyin . objects . get ( identificationcode = t . identificationcode ) . code ) . count ( )
2020-10-28 15:31:17 +00:00
res . append ( o )
2020-10-23 04:04:33 +00:00
2020-10-28 15:31:17 +00:00
return render ( request , ' monitor/timeliness-monitoring-douyin.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 ,
2021-01-06 07:14:57 +00:00
' organization_count_month ' : organization_count_month ,
2020-10-28 15:31:17 +00:00
' organization_count_week ' : organization_count_week , ' res ' : res ,
' timelinessmonitoring ' : timelinessmonitoring } )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-28 15:31:17 +00:00
def timeliness_monitoring_qita ( request ) :
now = datetime . datetime . now ( )
# 本周第一天和最后一天
this_week_start = now - timedelta ( days = now . weekday ( ) )
this_week_end = now + timedelta ( days = 6 - now . weekday ( ) )
# 本月第一天和最后一天
this_month_start = datetime . datetime ( now . year , now . month , 1 )
2020-12-25 00:55:34 +00:00
if now . month != 12 :
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 (
hours = 23 , minutes = 59 , seconds = 59 )
2020-10-28 15:31:17 +00:00
# 新媒体数量
new_media_count = int ( Weixin . objects . all ( ) . count ( ) ) + int ( Weibo . objects . all ( ) . count ( ) ) + int (
Toutiao . objects . all ( ) . count ( ) ) + int ( Douyin . objects . all ( ) . count ( ) ) + int ( Qita . objects . all ( ) . count ( ) )
new_media_count_month = int ( Weixin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_month_start , this_month_end ) ) . count ( ) )
new_media_count_week = int ( Weixin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Weibo . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Toutiao . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Douyin . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) ) + int (
Qita . objects . filter ( created__range = ( this_week_start , this_week_end ) ) . count ( ) )
# 内容更新次数
update_count = TimelinessMonitoring . objects . all ( ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
# update_count_month = TimelinessMonitoring.objects.filter(created__range=(this_month_start,this_month_end)).aggregate(nums=Sum('update'))['nums']
# update_count_week = TimelinessMonitoring.objects.filter(created__range=(this_week_start,this_week_end)).aggregate(nums=Sum('update'))['nums']
wrongly_count = Wrongly . objects . all ( ) . count
sensitive_count = None
organization_count = Organization . objects . all ( ) . count ( )
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 ( )
2021-01-07 04:04:02 +00:00
timelinessmonitoring = TimelinessMonitoring . objects . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . order_by (
2021-01-06 07:14:57 +00:00
' date ' )
2020-10-28 15:31:17 +00:00
res = [ ]
if timelinessmonitoring is not None :
paginator = Paginator ( timelinessmonitoring , 6 )
page = int ( request . GET . get ( ' page ' , 1 ) )
try :
timelinessmonitoring = paginator . page ( page )
except PageNotAnInteger :
timelinessmonitoring = paginator . page ( 1 )
except EmptyPage :
timelinessmonitoring = paginator . page ( paginator . num_pages )
for t in timelinessmonitoring :
o = dict ( )
o [ ' n_type ' ] = t . n_type
2021-01-07 04:04:02 +00:00
o [ ' count ' ] = \
TimelinessMonitoring . objects . filter ( identificationcode = t . identificationcode ) . aggregate ( nums = Sum ( ' update ' ) ) [
' nums ' ]
2021-01-06 07:14:57 +00:00
try :
o [ ' n_name ' ] = Qita . objects . get ( identificationcode = t . identificationcode ) . code
except :
2021-01-07 04:04:02 +00:00
print ( str ( t . identificationcode ) + " 6666666666666666666666666666666666666777 " )
2020-10-28 15:31:17 +00:00
o [ ' results ' ] = t . results
o [ ' update ' ] = t . update
2021-01-06 07:14:57 +00:00
o [ ' silent ' ] = t . silent
2020-10-28 15:31:17 +00:00
o [ ' start_data ' ] = t . start_data
o [ ' end_data ' ] = t . end_data
o [ ' date ' ] = t . date
2021-01-06 07:14:57 +00:00
o [ ' date_length ' ] = t . date_length
o [ ' city ' ] = Area_code_2020 . objects . get ( code = t . city ) . name
o [ ' district ' ] = Area_code_2020 . objects . get ( code = t . district ) . name
try :
o [ ' wrongly ' ] = Wrongly . objects . filter (
n_name = Douyin . objects . get ( identificationcode = t . identificationcode ) . code ) . count ( )
except :
2021-01-07 04:04:02 +00:00
print ( str ( t . identificationcode ) + " 111111111111111111111111111111111 " )
2020-10-28 15:31:17 +00:00
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 ,
2021-01-07 04:04:02 +00:00
' organization_count_month ' : organization_count_month ,
2020-10-28 15:31:17 +00:00
' organization_count_week ' : organization_count_week , ' res ' : res ,
' timelinessmonitoring ' : timelinessmonitoring } )
2020-10-19 08:52:51 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-30 12:29:10 +00:00
def error_monitoring ( request ) :
2020-10-29 07:19:15 +00:00
wrongly = Wrongly . objects . all ( )
paginator = Paginator ( wrongly , 8 )
page = int ( request . GET . get ( ' page ' , 1 ) )
try :
wrongly = paginator . page ( page )
except PageNotAnInteger :
wrongly = paginator . page ( 1 )
except EmptyPage :
wrongly = paginator . page ( paginator . num_pages )
2021-01-07 04:04:02 +00:00
return render ( request , ' monitor/error-monitoring.html ' , { ' wrongly ' : wrongly } )
2020-10-19 08:52:51 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-30 12:29:10 +00:00
def sensitive_word_monitoring ( request ) :
2021-01-07 04:04:02 +00:00
data = range ( 1 , 8 )
return render ( request , ' monitor/sensitive-word-monitoring.html ' , { ' data ' : data } )
2020-10-19 08:52:51 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-30 12:29:10 +00:00
def comment_on_interactive_monitoring ( request ) :
2020-11-18 07:48:17 +00:00
comment = Comment . objects . all ( ) . order_by ( ' -date ' )
paginator = Paginator ( comment , 8 )
page = int ( request . GET . get ( ' page ' , 1 ) )
try :
comment = paginator . page ( page )
except PageNotAnInteger :
comment = paginator . page ( 1 )
except EmptyPage :
comment = paginator . page ( paginator . num_pages )
2021-01-07 04:04:02 +00:00
return render ( request , ' monitor/comment-on-interactive-monitoring.html ' , { " comment " : comment } )
2020-10-19 08:52:51 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-09 01:42:05 +00:00
def comment_on_interactive_monitoring_json ( request ) :
2020-11-18 07:48:17 +00:00
data = Comment . objects . all ( )
2020-10-09 01:42:05 +00:00
r = [ ]
for d in data :
2020-11-18 07:48:17 +00:00
content = d . comment
2020-10-09 01:42:05 +00:00
r . append ( content )
# result = jieba.analyse.textrank(content, topK=400, withWeight=True)
seg_list = jieba . cut ( str ( r ) ) # 对文本进行分词
c = Counter ( )
for x in seg_list : # 进行词频统计
if len ( x ) > 1 and x != ' \r \n ' :
c [ x ] + = 1
res = [ ]
2020-11-18 07:48:17 +00:00
for ( k , v ) in c . most_common ( 250 ) : # 遍历输出高频词
2020-10-19 03:41:23 +00:00
# print('%s%s %s %d' % (' ' * (5 - len(k)), k, '*', v))
2020-10-19 08:52:51 +00:00
# 剔除不是汉字的值
if all ( map ( lambda c : ' \u4e00 ' < = c < = ' \u9fa5 ' , k ) ) :
2020-10-19 03:41:23 +00:00
o = dict ( )
o [ ' name ' ] = k
o [ ' value ' ] = v
res . append ( o )
2020-10-09 01:42:05 +00:00
return HttpResponse ( json . dumps ( {
2020-10-19 08:52:51 +00:00
" res " : res
2020-10-09 01:42:05 +00:00
} ) )
2020-10-19 08:52:51 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-09-30 12:29:10 +00:00
def monitoring_report ( request ) :
2020-10-19 08:52:51 +00:00
news = News . objects . filter ( type = ' 3 ' ) . order_by ( ' -date ' )
count = News . objects . filter ( type = ' 3 ' ) . count ( )
2020-10-30 11:36:22 +00:00
2020-10-28 15:31:17 +00:00
return render ( request , ' monitor/monitoring-report.html ' , { ' news ' : news , ' count ' : count } )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-30 11:36:22 +00:00
def monitoring_report_json ( request ) :
news = News . objects . filter ( type = ' 3 ' ) . order_by ( ' date ' )
# year_now = datetime.datetime.now().year
# year = range(2019, int(year_now) + 1)
# month = range(1, 13)
news_list = [ ]
for n in news :
o = dict ( )
# o['date'] = n.date
o [ ' count ' ] = 1
o [ ' year ' ] = str ( n . date ) . split ( ' - ' ) [ 0 ]
o [ ' month ' ] = str ( n . date ) . split ( ' - ' ) [ 1 ]
news_list . append ( o )
2021-01-07 04:04:02 +00:00
return JsonResponse ( news_list , safe = False )
2020-10-30 11:36:22 +00:00
2020-10-09 01:42:05 +00:00
def test ( request ) :
2020-10-19 08:52:51 +00:00
return render ( request , ' monitor/test.html ' )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-09 01:42:05 +00:00
def test_json ( request ) :
res = [ ]
2020-10-19 08:52:51 +00:00
with open ( ' D:/2020/舆论监测平台/新媒体监测数据/平凉/Result_PL.csv ' , encoding = ' utf-8 ' ) as csvfile :
2020-10-09 01:42:05 +00:00
reader = csv . reader ( csvfile )
results = [ ]
try :
for r in reader :
print ( r [ 0 ] )
results . append ( r [ 5 ] )
except :
print ( " 777777777777777777777777777777777777777777777777 " )
seg_list = jieba . cut ( str ( results ) ) # 对文本进行分词
c = Counter ( )
for x in seg_list : # 进行词频统计
if len ( x ) > 1 and x != ' \r \n ' :
c [ x ] + = 1
for ( k , v ) in c . most_common ( 200 ) : # 遍历输出高频词
2020-10-19 08:52:51 +00:00
if all ( map ( lambda c : ' \u4e00 ' < = c < = ' \u9fa5 ' , k ) ) :
2020-10-19 06:43:13 +00:00
o = dict ( )
o [ ' name ' ] = k
o [ ' value ' ] = v
res . append ( o )
2020-10-09 01:42:05 +00:00
return HttpResponse ( json . dumps ( {
" res " : res
} ) )
2020-10-29 07:19:15 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-10-29 07:19:15 +00:00
def timeliness_monitoring_json ( request ) :
2020-11-02 13:51:05 +00:00
date = TimelinessMonitoring . objects . distinct ( ' date ' )
date_list = [ ]
lanzhou = [ ]
2021-01-06 07:14:57 +00:00
lanzhou_YIELD = [ ]
2020-11-02 13:51:05 +00:00
jiayuguan = [ ]
2021-01-06 07:14:57 +00:00
jiayuguan_YIELD = [ ]
2020-11-02 13:51:05 +00:00
jinchang = [ ]
2021-01-06 07:14:57 +00:00
jinchang_YIELD = [ ]
2020-11-02 13:51:05 +00:00
jiuquan = [ ]
2021-01-06 07:14:57 +00:00
jiuquan_YIELD = [ ]
2020-11-02 13:51:05 +00:00
zhangye = [ ]
2021-01-06 07:14:57 +00:00
zhangye_YIELD = [ ]
2020-11-02 13:51:05 +00:00
wuwei = [ ]
2021-01-06 07:14:57 +00:00
wuwei_YIELD = [ ]
2020-11-02 13:51:05 +00:00
baiyin = [ ]
2021-01-06 07:14:57 +00:00
baiyin_YIELD = [ ]
2020-11-02 13:51:05 +00:00
tianshui = [ ]
2021-01-06 07:14:57 +00:00
tianshui_YIELD = [ ]
2020-11-02 13:51:05 +00:00
pingliang = [ ]
2021-01-06 07:14:57 +00:00
pingliang_YIELD = [ ]
2020-11-02 13:51:05 +00:00
qingyang = [ ]
2021-01-06 07:14:57 +00:00
qingyang_YIELD = [ ]
2020-11-02 13:51:05 +00:00
dingxi = [ ]
2021-01-06 07:14:57 +00:00
dingxi_YIELD = [ ]
2020-11-02 13:51:05 +00:00
longnan = [ ]
2021-01-06 07:14:57 +00:00
longnan_YIELD = [ ]
2020-11-02 13:51:05 +00:00
gannan = [ ]
2021-01-06 07:14:57 +00:00
gannan_YIELD = [ ]
2020-11-02 13:51:05 +00:00
linxia = [ ]
2021-01-06 07:14:57 +00:00
linxia_YIELD = [ ]
2020-11-02 13:51:05 +00:00
for d in date :
date_list . append ( d . date )
2021-01-07 04:04:02 +00:00
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 )
2021-01-06 07:14:57 +00:00
2020-10-29 07:19:15 +00:00
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" 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 ,
2020-10-30 11:36:22 +00:00
} ) )
2020-11-03 10:07:53 +00:00
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
def timeliness_monitoring_json_weixin ( request ) :
date = TimelinessMonitoring . objects . distinct ( ' date ' )
date_list = [ ]
lanzhou = [ ]
2021-01-06 07:14:57 +00:00
lanzhou_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiayuguan = [ ]
2021-01-06 07:14:57 +00:00
jiayuguan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jinchang = [ ]
2021-01-06 07:14:57 +00:00
jinchang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiuquan = [ ]
2021-01-06 07:14:57 +00:00
jiuquan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
zhangye = [ ]
2021-01-06 07:14:57 +00:00
zhangye_YIELD = [ ]
2020-11-03 10:07:53 +00:00
wuwei = [ ]
2021-01-06 07:14:57 +00:00
wuwei_YIELD = [ ]
2020-11-03 10:07:53 +00:00
baiyin = [ ]
2021-01-06 07:14:57 +00:00
baiyin_YIELD = [ ]
2020-11-03 10:07:53 +00:00
tianshui = [ ]
2021-01-06 07:14:57 +00:00
tianshui_YIELD = [ ]
2020-11-03 10:07:53 +00:00
pingliang = [ ]
2021-01-06 07:14:57 +00:00
pingliang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
qingyang = [ ]
2021-01-06 07:14:57 +00:00
qingyang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
dingxi = [ ]
2021-01-06 07:14:57 +00:00
dingxi_YIELD = [ ]
2020-11-03 10:07:53 +00:00
longnan = [ ]
2021-01-06 07:14:57 +00:00
longnan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
gannan = [ ]
2021-01-06 07:14:57 +00:00
gannan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
linxia = [ ]
2021-01-06 07:14:57 +00:00
linxia_YIELD = [ ]
2020-11-03 10:07:53 +00:00
for d in date :
date_list . append ( d . date )
2021-01-06 07:14:57 +00:00
lanzhou . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620100000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
jiayuguan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620200000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
jinchang . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620300000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
jiuquan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620900000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
zhangye . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620700000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
wuwei . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620600000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
baiyin . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620400000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
tianshui . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620500000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
pingliang . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620800000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
qingyang . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 621000000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
dingxi . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 621100000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
longnan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 621200000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
gannan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 623000000000 ' , date = d . date , n_type__contains = ' 微信 ' ) . aggregate (
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
2021-01-06 07:14:57 +00:00
linxia . append (
2021-01-07 04:04:02 +00:00
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 )
2021-01-06 07:14:57 +00:00
2020-11-03 10:07:53 +00:00
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" 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 ,
2020-11-03 10:07:53 +00:00
} ) )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
def timeliness_monitoring_json_weibo ( request ) :
date = TimelinessMonitoring . objects . distinct ( ' date ' )
date_list = [ ]
lanzhou = [ ]
2021-01-06 07:14:57 +00:00
lanzhou_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiayuguan = [ ]
2021-01-06 07:14:57 +00:00
jiayuguan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jinchang = [ ]
2021-01-06 07:14:57 +00:00
jinchang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiuquan = [ ]
2021-01-06 07:14:57 +00:00
jiuquan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
zhangye = [ ]
2021-01-06 07:14:57 +00:00
zhangye_YIELD = [ ]
2020-11-03 10:07:53 +00:00
wuwei = [ ]
2021-01-06 07:14:57 +00:00
wuwei_YIELD = [ ]
2020-11-03 10:07:53 +00:00
baiyin = [ ]
2021-01-06 07:14:57 +00:00
baiyin_YIELD = [ ]
2020-11-03 10:07:53 +00:00
tianshui = [ ]
2021-01-06 07:14:57 +00:00
tianshui_YIELD = [ ]
2020-11-03 10:07:53 +00:00
pingliang = [ ]
2021-01-06 07:14:57 +00:00
pingliang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
qingyang = [ ]
2021-01-06 07:14:57 +00:00
qingyang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
dingxi = [ ]
2021-01-06 07:14:57 +00:00
dingxi_YIELD = [ ]
2020-11-03 10:07:53 +00:00
longnan = [ ]
2021-01-06 07:14:57 +00:00
longnan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
gannan = [ ]
2021-01-06 07:14:57 +00:00
gannan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
linxia = [ ]
2021-01-06 07:14:57 +00:00
linxia_YIELD = [ ]
2020-11-03 10:07:53 +00:00
for d in date :
date_list . append ( d . date )
2021-01-06 07:14:57 +00:00
lanzhou . append (
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 ' ] )
jinchang . append (
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 ' ] )
zhangye . append (
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 ' ] )
baiyin . append (
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 ' ] )
pingliang . append (
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 ' ] )
dingxi . append (
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 ' ] )
gannan . append (
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 ' ] )
2021-01-07 04:04:02 +00:00
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 )
2021-01-06 07:14:57 +00:00
2020-11-03 10:07:53 +00:00
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" 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 ,
2020-11-03 10:07:53 +00:00
} ) )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
def timeliness_monitoring_json_toutiao ( request ) :
date = TimelinessMonitoring . objects . distinct ( ' date ' )
date_list = [ ]
lanzhou = [ ]
2021-01-06 07:14:57 +00:00
lanzhou_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiayuguan = [ ]
2021-01-06 07:14:57 +00:00
jiayuguan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jinchang = [ ]
2021-01-06 07:14:57 +00:00
jinchang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiuquan = [ ]
2021-01-06 07:14:57 +00:00
jiuquan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
zhangye = [ ]
2021-01-06 07:14:57 +00:00
zhangye_YIELD = [ ]
2020-11-03 10:07:53 +00:00
wuwei = [ ]
2021-01-06 07:14:57 +00:00
wuwei_YIELD = [ ]
2020-11-03 10:07:53 +00:00
baiyin = [ ]
2021-01-06 07:14:57 +00:00
baiyin_YIELD = [ ]
2020-11-03 10:07:53 +00:00
tianshui = [ ]
2021-01-06 07:14:57 +00:00
tianshui_YIELD = [ ]
2020-11-03 10:07:53 +00:00
pingliang = [ ]
2021-01-06 07:14:57 +00:00
pingliang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
qingyang = [ ]
2021-01-06 07:14:57 +00:00
qingyang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
dingxi = [ ]
2021-01-06 07:14:57 +00:00
dingxi_YIELD = [ ]
2020-11-03 10:07:53 +00:00
longnan = [ ]
2021-01-06 07:14:57 +00:00
longnan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
gannan = [ ]
2021-01-06 07:14:57 +00:00
gannan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
linxia = [ ]
2021-01-06 07:14:57 +00:00
linxia_YIELD = [ ]
2020-11-03 10:07:53 +00:00
for d in date :
date_list . append ( d . date )
2021-01-06 07:14:57 +00:00
lanzhou . append (
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 ' ] )
jinchang . append (
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 ' ] )
zhangye . append (
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 ' ] )
baiyin . append (
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 ' ] )
pingliang . append (
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 ' ] )
dingxi . append (
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 ' ] )
gannan . append (
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 ' ] )
2021-01-07 04:04:02 +00:00
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 )
2021-01-06 07:14:57 +00:00
2020-11-03 10:07:53 +00:00
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" 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 ,
2020-11-03 10:07:53 +00:00
} ) )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
def timeliness_monitoring_json_douyin ( request ) :
date = TimelinessMonitoring . objects . distinct ( ' date ' )
date_list = [ ]
lanzhou = [ ]
2021-01-06 07:14:57 +00:00
lanzhou_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiayuguan = [ ]
2021-01-06 07:14:57 +00:00
jiayuguan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jinchang = [ ]
2021-01-06 07:14:57 +00:00
jinchang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiuquan = [ ]
2021-01-06 07:14:57 +00:00
jiuquan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
zhangye = [ ]
2021-01-06 07:14:57 +00:00
zhangye_YIELD = [ ]
2020-11-03 10:07:53 +00:00
wuwei = [ ]
2021-01-06 07:14:57 +00:00
wuwei_YIELD = [ ]
2020-11-03 10:07:53 +00:00
baiyin = [ ]
2021-01-06 07:14:57 +00:00
baiyin_YIELD = [ ]
2020-11-03 10:07:53 +00:00
tianshui = [ ]
2021-01-06 07:14:57 +00:00
tianshui_YIELD = [ ]
2020-11-03 10:07:53 +00:00
pingliang = [ ]
2021-01-06 07:14:57 +00:00
pingliang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
qingyang = [ ]
2021-01-06 07:14:57 +00:00
qingyang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
dingxi = [ ]
2021-01-06 07:14:57 +00:00
dingxi_YIELD = [ ]
2020-11-03 10:07:53 +00:00
longnan = [ ]
2021-01-06 07:14:57 +00:00
longnan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
gannan = [ ]
2021-01-06 07:14:57 +00:00
gannan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
linxia = [ ]
2021-01-06 07:14:57 +00:00
linxia_YIELD = [ ]
2020-11-03 10:07:53 +00:00
for d in date :
date_list . append ( d . date )
2021-01-06 07:14:57 +00:00
lanzhou . append (
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 ' ] )
jinchang . append (
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 ' ] )
zhangye . append (
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 ' ] )
baiyin . append (
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 ' ] )
pingliang . append (
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 ' ] )
dingxi . append (
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 ' ] )
gannan . append (
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 ' ] )
2021-01-07 04:04:02 +00:00
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 )
2021-01-06 07:14:57 +00:00
2020-11-03 10:07:53 +00:00
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" 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 ,
2020-11-03 10:07:53 +00:00
} ) )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
def timeliness_monitoring_json_qita ( request ) :
date = TimelinessMonitoring . objects . distinct ( ' date ' )
date_list = [ ]
lanzhou = [ ]
2021-01-06 07:14:57 +00:00
lanzhou_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiayuguan = [ ]
2021-01-06 07:14:57 +00:00
jiayuguan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jinchang = [ ]
2021-01-06 07:14:57 +00:00
jinchang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
jiuquan = [ ]
2021-01-06 07:14:57 +00:00
jiuquan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
zhangye = [ ]
2021-01-06 07:14:57 +00:00
zhangye_YIELD = [ ]
2020-11-03 10:07:53 +00:00
wuwei = [ ]
2021-01-06 07:14:57 +00:00
wuwei_YIELD = [ ]
2020-11-03 10:07:53 +00:00
baiyin = [ ]
2021-01-06 07:14:57 +00:00
baiyin_YIELD = [ ]
2020-11-03 10:07:53 +00:00
tianshui = [ ]
2021-01-06 07:14:57 +00:00
tianshui_YIELD = [ ]
2020-11-03 10:07:53 +00:00
pingliang = [ ]
2021-01-06 07:14:57 +00:00
pingliang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
qingyang = [ ]
2021-01-06 07:14:57 +00:00
qingyang_YIELD = [ ]
2020-11-03 10:07:53 +00:00
dingxi = [ ]
2021-01-06 07:14:57 +00:00
dingxi_YIELD = [ ]
2020-11-03 10:07:53 +00:00
longnan = [ ]
2021-01-06 07:14:57 +00:00
longnan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
gannan = [ ]
2021-01-06 07:14:57 +00:00
gannan_YIELD = [ ]
2020-11-03 10:07:53 +00:00
linxia = [ ]
2021-01-06 07:14:57 +00:00
linxia_YIELD = [ ]
2020-11-03 10:07:53 +00:00
for d in date :
date_list . append ( d . date )
2021-01-06 07:14:57 +00:00
lanzhou . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620100000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
jiayuguan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620200000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
jinchang . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620300000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
jiuquan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620900000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
zhangye . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620700000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
wuwei . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620600000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
baiyin . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620400000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
tianshui . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620500000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
pingliang . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 620800000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
qingyang . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 621000000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
dingxi . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 621100000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
longnan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 621200000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
gannan . append (
2021-01-07 04:04:02 +00:00
TimelinessMonitoring . objects . filter ( city = ' 623000000000 ' , date = d . date ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 今日头条 ' , ' 抖音 ' , ' 微信订阅号 ' , ' 新浪微博 ' , ' 微信服务号 ' , ' 抖音短视频 ' , ' 小程序+微信 ' ] ) . aggregate (
2021-01-06 07:14:57 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ] )
linxia . append (
2021-01-07 04:04:02 +00:00
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 )
2021-01-06 07:14:57 +00:00
2020-11-03 10:07:53 +00:00
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" 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 ,
2020-11-03 10:07:53 +00:00
} ) )
2021-01-07 04:04:02 +00:00
2020-11-03 10:07:53 +00:00
@login_required
2020-11-03 06:51:47 +00:00
def index_map ( request ) :
2021-01-11 13:08:52 +00:00
name = request . GET . get ( ' name ' )
print ( name )
2020-11-03 06:51:47 +00:00
timelinessmonitoring_weixin = \
2021-01-11 13:08:52 +00:00
TimelinessMonitoring . objects . filter ( city = Area_code_2020 . objects . get ( name = name , level = 2 ) . code , n_type__contains = ' 微信 ' ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
2020-11-03 06:51:47 +00:00
timelinessmonitoring_weibo = \
2021-01-11 13:08:52 +00:00
TimelinessMonitoring . objects . filter ( city = Area_code_2020 . objects . get ( name = name , level = 2 ) . code , n_type__contains = ' 微博 ' ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
2020-11-03 06:51:47 +00:00
timelinessmonitoring_toutiao = \
2021-01-11 13:08:52 +00:00
TimelinessMonitoring . objects . filter ( city = Area_code_2020 . objects . get ( name = name , level = 2 ) . code , n_type__contains = ' 头条 ' ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
2020-11-03 06:51:47 +00:00
timelinessmonitoring_douyin = \
2021-01-11 13:08:52 +00:00
TimelinessMonitoring . objects . filter ( city = Area_code_2020 . objects . get ( name = name , level = 2 ) . code , n_type__contains = ' 抖音 ' ) . aggregate ( nums = Sum ( ' update ' ) ) [ ' nums ' ]
2020-11-03 06:51:47 +00:00
timelinessmonitoring_qita = \
2021-01-11 13:08:52 +00:00
TimelinessMonitoring . objects . filter ( city = Area_code_2020 . objects . get ( name = name , level = 2 ) . code ) . exclude (
n_type__in = [ ' 微信 ' , ' 微博 ' , ' 头条 ' , ' 抖音 ' ] ) . aggregate (
2020-11-03 06:51:47 +00:00
nums = Sum ( ' update ' ) ) [ ' nums ' ]
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" status " : " 1 " ,
" timelinessmonitoring_weixin " : timelinessmonitoring_weixin ,
" timelinessmonitoring_weibo " : timelinessmonitoring_weibo ,
" timelinessmonitoring_toutiao " : timelinessmonitoring_toutiao ,
" timelinessmonitoring_douyin " : timelinessmonitoring_douyin ,
" timelinessmonitoring_qita " : timelinessmonitoring_qita ,
2020-11-04 03:05:43 +00:00
} ) )
2021-01-07 04:04:02 +00:00
2020-11-04 03:05:43 +00:00
def index_newmedia_count ( request ) :
2021-01-07 04:04:02 +00:00
date_list = [ x . strftime ( ' % Y- % m- %d ' ) for x in list ( pd . date_range ( start = ' 2020-09-01 ' , end = datetime . datetime . now ( ) ) ) ]
2020-11-04 03:05:43 +00:00
weixin_list = [ ]
weibo_list = [ ]
toutiao_list = [ ]
douyin_list = [ ]
qita_list = [ ]
for d in date_list :
s = str ( d ) . split ( ' - ' )
2021-01-11 13:08:52 +00:00
weixin = Weixin . objects . filter ( created__lt = d ) . count ( )
2020-11-04 03:05:43 +00:00
weixin_list . append ( weixin )
2021-01-11 13:08:52 +00:00
weibo = Weibo . objects . filter ( created__lt = d ) . count ( )
2020-11-04 03:05:43 +00:00
weibo_list . append ( weibo )
2021-01-11 13:08:52 +00:00
toutiao = Toutiao . objects . filter ( created__lt = d ) . count ( )
2020-11-04 03:05:43 +00:00
toutiao_list . append ( toutiao )
2021-01-11 13:08:52 +00:00
douyin = Douyin . objects . filter ( created__lt = d ) . count ( )
2020-11-04 03:05:43 +00:00
douyin_list . append ( douyin )
2021-01-11 13:08:52 +00:00
qita = Qita . objects . filter ( created__lt = d ) . count ( )
2020-11-04 03:05:43 +00:00
qita_list . append ( qita )
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" status " : " 1 " ,
2021-01-11 13:08:52 +00:00
" date " : date_list ,
2021-01-07 04:04:02 +00:00
" weixin " : weixin_list ,
" weibo " : weibo_list ,
" toutiao " : toutiao_list ,
" douyin " : douyin_list ,
" qita " : qita_list ,
2020-11-04 03:05:43 +00:00
} ) )
2021-01-07 04:04:02 +00:00
2020-11-04 03:52:36 +00:00
def index_warning_count ( request ) :
2020-11-20 10:41:18 +00:00
# date_list = [x.strftime('%Y-%m-%d') for x in list(pd.date_range(start='2019-07-01',end=datetime.datetime.now()))]
2020-11-18 07:48:17 +00:00
# data = []
2020-11-20 10:41:18 +00:00
# for d in date_list:
# news = News.objects.filter(type='3',date=d).count()
2020-11-18 07:48:17 +00:00
# data.append(news)
2020-11-20 10:41:18 +00:00
# print(str(data)+"6666666666666666666666666666666")
date = News . objects . distinct ( ' date ' ) . order_by ( ' -date ' )
data = [ ]
date_list = [ ]
for d in date :
date_list . append ( str ( d . date ) )
news = News . objects . filter ( type = ' 3 ' , date = str ( d . date ) ) . count ( )
data . append ( news )
2020-11-04 03:52:36 +00:00
return HttpResponse ( json . dumps ( {
2021-01-07 04:04:02 +00:00
" status " : " 1 " ,
" data " : data ,
" date_list " : date_list
2020-11-04 03:52:36 +00:00
} ) )
2021-01-07 04:04:02 +00:00
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 ] ,
} ) )