add message
This commit is contained in:
parent
e964957abc
commit
3466b6c88b
|
@ -210,34 +210,39 @@ class NewMedia(models.Model):
|
|||
@classmethod
|
||||
def category_one_count(cls):
|
||||
t1 = Weixin.objects.exclude(
|
||||
status=0,
|
||||
organization__province=''
|
||||
).filter(
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t2 = Weibo.objects.exclude(
|
||||
status=0,
|
||||
organization__province=''
|
||||
).filter(
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t3 = Toutiao.objects.exclude(
|
||||
status=0,
|
||||
organization__province=''
|
||||
).filter(
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t4 = Douyin.objects.exclude(
|
||||
status=0,
|
||||
organization__province=''
|
||||
).filter(
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t5 = Qita.objects.exclude(
|
||||
status=0,
|
||||
organization__province=''
|
||||
).filter(
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
return t1 + t2 + t3 + t4 + t5
|
||||
|
||||
|
@ -245,59 +250,69 @@ class NewMedia(models.Model):
|
|||
def category_two_count(cls):
|
||||
t1 = Weixin.objects.exclude(
|
||||
organization__province='',
|
||||
organization__cities=''
|
||||
organization__cities='',
|
||||
status=0
|
||||
).filter(
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t2 = Weibo.objects.exclude(
|
||||
organization__province='',
|
||||
organization__cities=''
|
||||
organization__cities='',
|
||||
status=0
|
||||
).filter(
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t3 = Toutiao.objects.exclude(
|
||||
organization__province='',
|
||||
organization__cities=''
|
||||
organization__cities='',
|
||||
status=0
|
||||
).filter(
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t4 = Douyin.objects.exclude(
|
||||
organization__province='',
|
||||
organization__cities=''
|
||||
organization__cities='',
|
||||
status=0
|
||||
).filter(
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
t5 = Qita.objects.exclude(
|
||||
organization__province='',
|
||||
organization__cities=''
|
||||
organization__cities='',
|
||||
status=0
|
||||
).filter(
|
||||
organization__district=''
|
||||
organization__district='',
|
||||
).count()
|
||||
return t1 + t2 + t3 + t4 + t5
|
||||
|
||||
@classmethod
|
||||
def category_three_count(cls):
|
||||
t1 = Weixin.objects.exclude(
|
||||
status=0,
|
||||
organization__province='',
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
).count()
|
||||
t2 = Weibo.objects.exclude(
|
||||
status=0,
|
||||
organization__province='',
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
).count()
|
||||
t3 = Toutiao.objects.exclude(
|
||||
status=0,
|
||||
organization__province='',
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
).count()
|
||||
t4 = Douyin.objects.exclude(
|
||||
status=0,
|
||||
organization__province='',
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
).count()
|
||||
t5 = Qita.objects.exclude(
|
||||
status=0,
|
||||
organization__province='',
|
||||
organization__cities='',
|
||||
organization__district=''
|
||||
|
|
Binary file not shown.
|
@ -26,11 +26,11 @@ COMPARTMENTS = {
|
|||
|
||||
@csrf_exempt
|
||||
def monitor_statistics(request):
|
||||
wbc = Weibo.objects.count()
|
||||
wxc = Weixin.objects.count()
|
||||
ttc = Toutiao.objects.count()
|
||||
qtc = Qita.objects.count()
|
||||
dyc = Douyin.objects.count()
|
||||
wbc = Weibo.objects.exclude(status=0).count()
|
||||
wxc = Weixin.objects.exclude(status=0).count()
|
||||
ttc = Toutiao.objects.exclude(status=0).count()
|
||||
qtc = Qita.objects.exclude(status=0).count()
|
||||
dyc = Douyin.objects.exclude(status=0).count()
|
||||
total = wbc+wxc+ttc+qtc+dyc
|
||||
|
||||
chart1_data = []
|
||||
|
@ -41,10 +41,12 @@ def monitor_statistics(request):
|
|||
chart1_data.append({'name': '其它', 'value': qtc})
|
||||
|
||||
results = dict()
|
||||
q = Weixin.objects.exclude(organization__cities='').values('organization__cities').order_by(
|
||||
q = Weixin.objects.exclude(organization__cities='', status=0).values('organization__cities').order_by(
|
||||
'organization__cities').annotate(num_media=Count('organization__cities'))
|
||||
for row in q:
|
||||
code = row['organization__cities']
|
||||
if not code:
|
||||
continue
|
||||
compartment = COMPARTMENTS[code]
|
||||
if code in results:
|
||||
nums = results[compartment]
|
||||
|
@ -52,10 +54,12 @@ def monitor_statistics(request):
|
|||
else:
|
||||
results[compartment] = [row['num_media']]
|
||||
|
||||
q = Weibo.objects.exclude(organization__cities='').values('organization__cities').order_by(
|
||||
q = Weibo.objects.exclude(organization__cities='', status=0).values('organization__cities').order_by(
|
||||
'organization__cities').annotate(num_media=Count('organization__cities'))
|
||||
for row in q:
|
||||
code = row['organization__cities']
|
||||
if not code:
|
||||
continue
|
||||
compartment = COMPARTMENTS[code]
|
||||
if compartment in results:
|
||||
nums = results[compartment]
|
||||
|
@ -63,10 +67,12 @@ def monitor_statistics(request):
|
|||
else:
|
||||
results[compartment] = [row['num_media']]
|
||||
|
||||
q = Toutiao.objects.exclude(organization__cities='').values('organization__cities').order_by(
|
||||
q = Toutiao.objects.exclude(organization__cities='', status=0).values('organization__cities').order_by(
|
||||
'organization__cities').annotate(num_media=Count('organization__cities'))
|
||||
for row in q:
|
||||
code = row['organization__cities']
|
||||
if not code:
|
||||
continue
|
||||
compartment = COMPARTMENTS[code]
|
||||
if compartment in results:
|
||||
nums = results[compartment]
|
||||
|
@ -74,10 +80,12 @@ def monitor_statistics(request):
|
|||
else:
|
||||
results[compartment] = [row['num_media']]
|
||||
|
||||
q = Douyin.objects.exclude(organization__cities='').values('organization__cities').order_by(
|
||||
q = Douyin.objects.exclude(organization__cities='', status=0).values('organization__cities').order_by(
|
||||
'organization__cities').annotate(num_media=Count('organization__cities'))
|
||||
for row in q:
|
||||
code = row['organization__cities']
|
||||
if not code:
|
||||
continue
|
||||
compartment = COMPARTMENTS[code]
|
||||
if compartment in results:
|
||||
nums = results[compartment]
|
||||
|
@ -85,10 +93,12 @@ def monitor_statistics(request):
|
|||
else:
|
||||
results[compartment] = [row['num_media']]
|
||||
|
||||
q = Qita.objects.exclude(organization__cities='').values('organization__cities').order_by(
|
||||
q = Qita.objects.exclude(organization__cities='', status=0).values('organization__cities').order_by(
|
||||
'organization__cities').annotate(num_media=Count('organization__cities'))
|
||||
for row in q:
|
||||
code = row['organization__cities']
|
||||
if not code:
|
||||
continue
|
||||
compartment = COMPARTMENTS[code]
|
||||
if compartment in results:
|
||||
nums = results[compartment]
|
||||
|
@ -96,7 +106,6 @@ def monitor_statistics(request):
|
|||
else:
|
||||
results[compartment] = [row['num_media']]
|
||||
|
||||
|
||||
chart2_data = []
|
||||
for k in results:
|
||||
chart2_data.append({'name': k, 'value': sum(results[k])})
|
||||
|
|
Loading…
Reference in New Issue