#修改
This commit is contained in:
parent
642d65d405
commit
a32d01b564
|
@ -708,11 +708,11 @@ class TimelinessMonitoring(models.Model):
|
||||||
counties = models.CharField('县区',max_length=256,null=True,blank=True)
|
counties = models.CharField('县区',max_length=256,null=True,blank=True)
|
||||||
remark = models.CharField('备注',max_length=256,null=True,blank=True)
|
remark = models.CharField('备注',max_length=256,null=True,blank=True)
|
||||||
results = models.CharField('监测结果',max_length=256,null=True,blank=True)
|
results = models.CharField('监测结果',max_length=256,null=True,blank=True)
|
||||||
update = models.CharField('更新次数',max_length=256,null=True,blank=True)
|
update = models.IntegerField('更新次数',max_length=256,null=True,blank=True)
|
||||||
silet = models.CharField('最大连续静默日数',max_length=256,null= True,blank=True)
|
silet = models.IntegerField('最大连续静默日数',max_length=256,null= True,blank=True)
|
||||||
start_data = models.CharField('开始时间',max_length=256,null=True,blank=True)
|
start_data = models.CharField('开始时间',max_length=256,null=True,blank=True)
|
||||||
end_data = models.CharField('结束时间',max_length=256,null=True,blank=True)
|
end_data = models.CharField('结束时间',max_length=256,null=True,blank=True)
|
||||||
comment = models.CharField('评论次数',max_length=256,null=True,blank=True)
|
comment = models.IntegerField('评论次数',max_length=256,null=True,blank=True)
|
||||||
date = models.CharField('最近更新时间',max_length=256,null=True,blank=True)
|
date = models.CharField('最近更新时间',max_length=256,null=True,blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
<div class="content-body">
|
<div class="content-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2 col-sm-6 col-xs-6">
|
<div class="col-md-2 col-sm-6 col-xs-6">
|
||||||
|
<a href="{% url 'newmedia-management-edit-weixin' %}">
|
||||||
<div class="r4_counter db_box">
|
<div class="r4_counter db_box">
|
||||||
{# <i class='pull-left fa fa-thumbs-up icon-md icon-rounded icon-primary'></i>#}
|
{# <i class='pull-left fa fa-thumbs-up icon-md icon-rounded icon-primary'></i>#}
|
||||||
<img src="{% static 'dashboard/image/weixin.png' %}"
|
<img src="{% static 'dashboard/image/weixin.png' %}"
|
||||||
|
@ -87,8 +88,10 @@
|
||||||
<span>微信</span>
|
<span>微信</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-sm-6 col-xs-6">
|
<div class="col-md-2 col-sm-6 col-xs-6">
|
||||||
|
<a href="{% url 'newmedia-management-edit-weibo' %}">
|
||||||
<div class="r4_counter db_box">
|
<div class="r4_counter db_box">
|
||||||
{# <i class='pull-left fa fa-shopping-cart icon-md icon-rounded icon-orange'></i>#}
|
{# <i class='pull-left fa fa-shopping-cart icon-md icon-rounded icon-orange'></i>#}
|
||||||
<img src="{% static 'dashboard/image/weibo.png' %}"
|
<img src="{% static 'dashboard/image/weibo.png' %}"
|
||||||
|
@ -98,8 +101,10 @@
|
||||||
<span>微博</span>
|
<span>微博</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-sm-6 col-xs-6">
|
<div class="col-md-2 col-sm-6 col-xs-6">
|
||||||
|
<a href="{% url 'newmedia-management-edit-toutiao' %}">
|
||||||
<div class="r4_counter db_box">
|
<div class="r4_counter db_box">
|
||||||
{# <i class='pull-left fa fa-dollar icon-md icon-rounded icon-purple'></i>#}
|
{# <i class='pull-left fa fa-dollar icon-md icon-rounded icon-purple'></i>#}
|
||||||
<img src="{% static 'dashboard/image/toutiao.png' %}"
|
<img src="{% static 'dashboard/image/toutiao.png' %}"
|
||||||
|
@ -109,8 +114,10 @@
|
||||||
<span>今日头条</span>
|
<span>今日头条</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-sm-6 col-xs-6">
|
<div class="col-md-2 col-sm-6 col-xs-6">
|
||||||
|
<a href="{% url 'newmedia-management-edit-douyin' %}">
|
||||||
<div class="r4_counter db_box">
|
<div class="r4_counter db_box">
|
||||||
{# <i class='pull-left fa fa-dollar icon-md icon-rounded icon-purple'></i>#}
|
{# <i class='pull-left fa fa-dollar icon-md icon-rounded icon-purple'></i>#}
|
||||||
<img src="{% static 'dashboard/image/douyin.jpg' %}"
|
<img src="{% static 'dashboard/image/douyin.jpg' %}"
|
||||||
|
@ -120,8 +127,10 @@
|
||||||
<span>抖音</span>
|
<span>抖音</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-sm-6 col-xs-6">
|
<div class="col-md-2 col-sm-6 col-xs-6">
|
||||||
|
<a href="{% url 'newmedia-management-edit-qita' %}">
|
||||||
<div class="r4_counter db_box">
|
<div class="r4_counter db_box">
|
||||||
{# <i class='pull-left fa fa-users icon-md icon-rounded icon-warning'></i>#}
|
{# <i class='pull-left fa fa-users icon-md icon-rounded icon-warning'></i>#}
|
||||||
<img src="{% static 'dashboard/image/qita.png' %}"
|
<img src="{% static 'dashboard/image/qita.png' %}"
|
||||||
|
@ -131,8 +140,10 @@
|
||||||
<span>其他新媒体</span>
|
<span>其他新媒体</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-sm-6 col-xs-6">
|
<div class="col-md-2 col-sm-6 col-xs-6">
|
||||||
|
<a href="{% url 'organization-management-management' %}">
|
||||||
<div class="r4_counter db_box">
|
<div class="r4_counter db_box">
|
||||||
{# <i class='pull-left fa fa-users icon-md icon-rounded icon-warning'></i>#}
|
{# <i class='pull-left fa fa-users icon-md icon-rounded icon-warning'></i>#}
|
||||||
<img src="{% static 'dashboard/image/shuliang.jpg' %}"
|
<img src="{% static 'dashboard/image/shuliang.jpg' %}"
|
||||||
|
@ -142,6 +153,7 @@
|
||||||
<span>注册单位</span>
|
<span>注册单位</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- End .row -->
|
</div> <!-- End .row -->
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
|
|
|
@ -65,35 +65,35 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
{# <div class="panel-body">#}
|
||||||
<div class="panel panel-default">
|
{# <div class="panel panel-default">#}
|
||||||
<div class="panel-heading">热点评论</div>
|
{# <div class="panel-heading">热点评论</div>#}
|
||||||
<div class="panel panel-default">
|
{# <div class="panel panel-default">#}
|
||||||
<!-- Default panel contents -->
|
{# <!-- Default panel contents -->#}
|
||||||
<table class="table table-hover" style="font-size: 14px">
|
{# <table class="table table-hover" style="font-size: 14px">#}
|
||||||
<thead>
|
{# <thead>#}
|
||||||
<tr>
|
{# <tr>#}
|
||||||
<th style="text-align: center">新媒体类型</th>
|
{# <th style="text-align: center">新媒体类型</th>#}
|
||||||
<th style="text-align: center">账号名</th>
|
{# <th style="text-align: center">账号名</th>#}
|
||||||
<th style="text-align: center">评论内容</th>
|
{# <th style="text-align: center">评论内容</th>#}
|
||||||
<th style="text-align: center">时间</th>
|
{# <th style="text-align: center">时间</th>#}
|
||||||
<th style="text-align: center">跟评数</th>
|
{# <th style="text-align: center">跟评数</th>#}
|
||||||
</tr>
|
{# </tr>#}
|
||||||
</thead>
|
{# </thead>#}
|
||||||
<tbody>
|
{# <tbody>#}
|
||||||
<tr>
|
{# <tr>#}
|
||||||
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
|
{# <td style="vertical-align: middle;text-align: center">{{ r.date }}</td>#}
|
||||||
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
|
{# <td style="vertical-align: middle;text-align: center">{{ r.date }}</td>#}
|
||||||
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
|
{# <td style="vertical-align: middle;text-align: center">{{ r.date }}</td>#}
|
||||||
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
|
{# <td style="vertical-align: middle;text-align: center">{{ r.date }}</td>#}
|
||||||
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
|
{# <td style="vertical-align: middle;text-align: center">{{ r.date }}</td>#}
|
||||||
</tr>
|
{# </tr>#}
|
||||||
</tbody>
|
{# </tbody>#}
|
||||||
</table>
|
{# </table>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
|
{##}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -25,15 +25,15 @@
|
||||||
<div class="list-group col-md-2 ">
|
<div class="list-group col-md-2 ">
|
||||||
<a href="#" class="list-group-item active" style="text-align: center">
|
<a href="#" class="list-group-item active" style="text-align: center">
|
||||||
<h4 class="list-group-item-heading">新媒体数量</h4>
|
<h4 class="list-group-item-heading">新媒体数量</h4>
|
||||||
<p class="list-group-item-text">288</p>
|
<p class="list-group-item-text">{{ new_media_count }}</p>
|
||||||
<p class="list-group-item-text">本周新增</p>
|
<p class="list-group-item-text">本周新增{{ new_media_count_week }}</p>
|
||||||
<p class="list-group-item-text">本月新增</p>
|
<p class="list-group-item-text">本月新增{{ new_media_count_month }}</p>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-group col-md-2 ">
|
<div class="list-group col-md-2 ">
|
||||||
<a href="#" class="list-group-item active" style="text-align: center">
|
<a href="#" class="list-group-item active" style="text-align: center">
|
||||||
<h4 class="list-group-item-heading">内容更新次数</h4>
|
<h4 class="list-group-item-heading">内容更新次数</h4>
|
||||||
<p class="list-group-item-text">288</p>
|
<p class="list-group-item-text">{{ update_count }}</p>
|
||||||
<p class="list-group-item-text">本周新增次数</p>
|
<p class="list-group-item-text">本周新增次数</p>
|
||||||
<p class="list-group-item-text">本月新增次数</p>
|
<p class="list-group-item-text">本月新增次数</p>
|
||||||
</a>
|
</a>
|
||||||
|
@ -57,14 +57,14 @@
|
||||||
<div class="list-group col-md-2 ">
|
<div class="list-group col-md-2 ">
|
||||||
<a href="#" class="list-group-item active" style="text-align: center">
|
<a href="#" class="list-group-item active" style="text-align: center">
|
||||||
<h4 class="list-group-item-heading">敏感词</h4>
|
<h4 class="list-group-item-heading">敏感词</h4>
|
||||||
<p class="list-group-item-text">288</p>
|
<p class="list-group-item-text">0</p>
|
||||||
<p class="list-group-item-text">本周新增</p>
|
<p class="list-group-item-text">本周新增0</p>
|
||||||
<p class="list-group-item-text">本月新增</p>
|
<p class="list-group-item-text">本月新增0</p>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-group col-md-2 ">
|
<div class="list-group col-md-2 ">
|
||||||
<a href="#" class="list-group-item active list-group-item-success" style="text-align: center">
|
<a href="#" class="list-group-item active" style="text-align: center">
|
||||||
<h4 class="list-group-item-heading">新媒体数量</h4>
|
<h4 class="list-group-item-heading">主体数量</h4>
|
||||||
<p class="list-group-item-text">288</p>
|
<p class="list-group-item-text">288</p>
|
||||||
<p class="list-group-item-text">本周新增</p>
|
<p class="list-group-item-text">本周新增</p>
|
||||||
<p class="list-group-item-text">本月新增</p>
|
<p class="list-group-item-text">本月新增</p>
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import csv
|
import csv
|
||||||
|
import datetime
|
||||||
import json
|
import json
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
import jieba
|
import jieba
|
||||||
|
from django.db.models import Sum
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from datetime import timedelta
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita, \
|
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita, \
|
||||||
Douyin, Douyin_data, News
|
Douyin, Douyin_data, News, TimelinessMonitoring, Organization, Wrongly
|
||||||
from monitor.models import Test
|
from monitor.models import Test
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +121,29 @@ def new_media_public_opinion_qita(request):
|
||||||
|
|
||||||
|
|
||||||
def timeliness_monitoring(request):
|
def timeliness_monitoring(request):
|
||||||
return render(request, 'monitor/timeliness-monitoring.html')
|
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)
|
||||||
|
this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
|
||||||
|
hours=23, minutes=59, seconds=59)
|
||||||
|
new_media_count = int(Weixin.objects.all().count())+int(Weibo.objects.all().count())+int(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().count()
|
||||||
|
update = TimelinessMonitoring.objects.all().aggregate(nums=Sum('update'))
|
||||||
|
update_count = update['nums']
|
||||||
|
|
||||||
|
|
||||||
|
comment = TimelinessMonitoring.objects.all().aggregate(nums=Sum('comment'))
|
||||||
|
comment_count = comment['nums']
|
||||||
|
wrongly_count = Wrongly.objects.all().count
|
||||||
|
sensitive_count = None
|
||||||
|
organization_count = Organization.objects.all().count()
|
||||||
|
|
||||||
|
return render(request, 'monitor/timeliness-monitoring.html',{'new_media_count':new_media_count,'new_media_count_month':new_media_count_month,'new_media_count_week':new_media_count_week,'update_count':update_count,'comment_count':comment_count,'wrongly_count':wrongly_count,'organization_count':organization_count})
|
||||||
|
|
||||||
|
|
||||||
def error_monitoring(request):
|
def error_monitoring(request):
|
||||||
|
|
Loading…
Reference in New Issue