This commit is contained in:
Bob 2020-10-28 23:31:17 +08:00
parent 9e9e16c5e8
commit 8e994f1c93
13 changed files with 1259 additions and 49 deletions

View File

@ -738,12 +738,12 @@ 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('更新次数', null=True, blank=True)
silet = models.CharField('最大连续静默日数', max_length=256, null=True, blank=True) silet = models.CharField('最大连续静默日数', max_length=256, null=True, blank=True)
start_data = models.CharField( start_data = models.CharField(
'开始时间', max_length=256, null=True, blank=True) '开始时间', 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('评论次数', 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):

View File

@ -41,8 +41,8 @@
</a> </a>
</li> </li>
{# <li class="open">#} {# <li class="open">#}
<li {% if url_name == 'monitor-timeliness-monitoring' %} class="open" {% endif %}> <li {% if url_name == 'monitor-timeliness-monitoring-weixin' %} class="open" {% endif %}>
<a href="{% url 'monitor-timeliness-monitoring' %}"> <a href="{% url 'monitor-timeliness-monitoring-weixin' %}">
<i class="fa fa-map-marker"></i> <i class="fa fa-map-marker"></i>
<span class="title">时效性监测</span> <span class="title">时效性监测</span>
{# <span class="arrow "></span>#} {# <span class="arrow "></span>#}

View File

@ -0,0 +1,18 @@
<div id="pages" class="text-center">
<nav>
<ul class="pagination">
<li class="step-links">
{% if timelinessmonitoring.has_previous %}
<a class='active' href="?page={{ timelinessmonitoring.previous_page_number }}">上一页</a>
{% endif %}
<span class="current">
第{{ timelinessmonitoring.number }}页 共{{ timelinessmonitoring.paginator.num_pages }}页</span>
{% if timelinessmonitoring.has_next %}
<a class='active' href="?page={{ timelinessmonitoring.next_page_number }}">下一页</a>
{% endif %}
</li>
</ul>
</nav>
</div>

View File

@ -51,7 +51,7 @@
<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">电话<a href="{% url 'user-management-management-sort' %}">^</a></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>

View File

@ -5,6 +5,7 @@ from management import views
urlpatterns = [ urlpatterns = [
# 用户管理 # 用户管理
path('user/management/', views.user_management, name='user-management-management'), path('user/management/', views.user_management, name='user-management-management'),
path('user/management/?sort=username/', views.user_management, name='user-management-management-sort'),
path('user/delete/<str:pk>/', views.user_delete, name='user-management-delete'), path('user/delete/<str:pk>/', views.user_delete, name='user-management-delete'),
path('user/update/<str:pk>/', views.user_update, name='user-management-update'), path('user/update/<str:pk>/', views.user_update, name='user-management-update'),
# 矩阵管理 # 矩阵管理

View File

@ -76,7 +76,7 @@
<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>
@ -87,8 +87,8 @@
{% for r in res %} {% for r in res %}
<tr> <tr>
<td style="vertical-align: middle;text-align: center">{{ r.code }}</td> <td style="vertical-align: middle;text-align: center">{{ r.code }}</td>
<td style="vertical-align: middle;text-align: center"><img src="{{ r.image.url }}" style="width: 40px;height: 40px;" {# <td style="vertical-align: middle;text-align: center"><img src="{{ r.image.url }}" style="width: 40px;height: 40px;"#}
class="img-circle"></td> {# class="img-circle"></td>#}
<td style="vertical-align: middle;text-align: center">{{ r.title }}</td> <td style="vertical-align: middle;text-align: center">{{ r.title }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.comment }}</td> <td style="vertical-align: middle;text-align: center">{{ r.comment }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.reply }}</td> <td style="vertical-align: middle;text-align: center">{{ r.reply }}</td>

View File

@ -0,0 +1,208 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<div class="page-container row-fluid">
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<section id="main-content" class=" ">
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
{% if messages %}
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% for message in messages %}
{{ message }}.<br/>
{% endfor %}
</div>
{% endif %}
</section>
<div class="panel">
<div class="panel-body">
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">新媒体数量</h4>
<p class="list-group-item-text">{{ new_media_count }}</p>
<p class="list-group-item-text">本周新增{{ new_media_count_week }}</p>
<p class="list-group-item-text">本月新增{{ new_media_count_month }}</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">内容更新次数</h4>
<p class="list-group-item-text">{{ update_count }}</p>
<p class="list-group-item-text">本周新增次数0</p>
<p class="list-group-item-text">本月新增次数0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">评论数量</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">错别字</h4>
<p class="list-group-item-text">{{ wrongly_count }}</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">敏感词</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">主体数量</h4>
<p class="list-group-item-text">{{ organization_count }}</p>
<p class="list-group-item-text">本周新增{{ organization_count_week }}</p>
<p class="list-group-item-text">本月新增{{ organization_count_month }}</p>
</a>
</div>
</div>
<div class="panel-body">
<div id="main" style="width: 100%;height:400px;"></div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation"><a
href="{% url 'monitor-timeliness-monitoring-weixin' %}">微信</a></li>
<li role="presentation"><a
href="{% url 'monitor-timeliness-monitoring-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-weibo' %}">微博</a>
</li>
<li role="presentation" class="active"><a href="{% url 'monitor-timeliness-monitoring-douyin' %}">抖音</a>
</li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-qita' %}">其他</a>
</li>
</ul>
</div>
<table class="table table-hover" style="font-size: 14px">
<thead>
<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>
</tr>
</thead>
<tbody>
{% for r in res %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.n_name }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.start_data }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.silet }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">{{ r.wrongly }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/timeliness-monitoring.html' %}
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'js/echarts.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/chart-sparkline.js' %}" type="text/javascript"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
title: {
text: '更新次数/天'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['微信', '微博', '头条', '抖音', '其他']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
yAxis: {
type: 'value'
},
series: [
{
name: '微信',
type: 'line',
stack: '总量',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '微博',
type: 'line',
stack: '总量',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '头条',
type: 'line',
stack: '总量',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '抖音',
type: 'line',
stack: '总量',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '其他',
type: 'line',
stack: '总量',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
{% endblock %}

View File

@ -0,0 +1,210 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<div class="page-container row-fluid">
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<section id="main-content" class=" ">
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
{% if messages %}
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% for message in messages %}
{{ message }}.<br/>
{% endfor %}
</div>
{% endif %}
</section>
<div class="panel">
<div class="panel-body">
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">新媒体数量</h4>
<p class="list-group-item-text">{{ new_media_count }}</p>
<p class="list-group-item-text">本周新增{{ new_media_count_week }}</p>
<p class="list-group-item-text">本月新增{{ new_media_count_month }}</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">内容更新次数</h4>
<p class="list-group-item-text">{{ update_count }}</p>
<p class="list-group-item-text">本周新增次数0</p>
<p class="list-group-item-text">本月新增次数0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">评论数量</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">错别字</h4>
<p class="list-group-item-text">{{ wrongly_count }}</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">敏感词</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">主体数量</h4>
<p class="list-group-item-text">{{ organization_count }}</p>
<p class="list-group-item-text">本周新增{{ organization_count_week }}</p>
<p class="list-group-item-text">本月新增{{ organization_count_month }}</p>
</a>
</div>
</div>
<div class="panel-body">
<div id="main" style="width: 100%;height:400px;"></div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation"><a
href="{% url 'monitor-timeliness-monitoring-weixin' %}">微信</a></li>
<li role="presentation"><a
href="{% url 'monitor-timeliness-monitoring-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-weibo' %}">微博</a>
</li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-douyin' %}">抖音</a>
</li>
<li role="presentation" class="active"><a href="{% url 'monitor-timeliness-monitoring-qita' %}">其他</a>
</li>
</ul>
</div>
<table class="table table-hover" style="font-size: 14px">
<thead>
<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>
</thead>
<tbody>
{% for r in res %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.n_type }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.n_name }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.start_data }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.silet }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">{{ r.wrongly }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/timeliness-monitoring.html' %}
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'js/echarts.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/chart-sparkline.js' %}" type="text/javascript"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
title: {
text: '更新次数/天'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['微信', '微博', '头条', '抖音', '其他']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
yAxis: {
type: 'value'
},
series: [
{
name: '微信',
type: 'line',
stack: '总量',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '微博',
type: 'line',
stack: '总量',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '头条',
type: 'line',
stack: '总量',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '抖音',
type: 'line',
stack: '总量',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '其他',
type: 'line',
stack: '总量',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
{% endblock %}

View File

@ -0,0 +1,208 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<div class="page-container row-fluid">
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<section id="main-content" class=" ">
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
{% if messages %}
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% for message in messages %}
{{ message }}.<br/>
{% endfor %}
</div>
{% endif %}
</section>
<div class="panel">
<div class="panel-body">
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">新媒体数量</h4>
<p class="list-group-item-text">{{ new_media_count }}</p>
<p class="list-group-item-text">本周新增{{ new_media_count_week }}</p>
<p class="list-group-item-text">本月新增{{ new_media_count_month }}</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">内容更新次数</h4>
<p class="list-group-item-text">{{ update_count }}</p>
<p class="list-group-item-text">本周新增次数0</p>
<p class="list-group-item-text">本月新增次数0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">评论数量</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">错别字</h4>
<p class="list-group-item-text">{{ wrongly_count }}</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">敏感词</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">主体数量</h4>
<p class="list-group-item-text">{{ organization_count }}</p>
<p class="list-group-item-text">本周新增{{ organization_count_week }}</p>
<p class="list-group-item-text">本月新增{{ organization_count_month }}</p>
</a>
</div>
</div>
<div class="panel-body">
<div id="main" style="width: 100%;height:400px;"></div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation"><a
href="{% url 'monitor-timeliness-monitoring-weixin' %}">微信</a></li>
<li role="presentation" class="active"><a
href="{% url 'monitor-timeliness-monitoring-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-weibo' %}">微博</a>
</li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-douyin' %}">抖音</a>
</li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-qita' %}">其他</a>
</li>
</ul>
</div>
<table class="table table-hover" style="font-size: 14px">
<thead>
<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>
</tr>
</thead>
<tbody>
{% for r in res %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.n_name }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.start_data }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.silet }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">{{ r.wrongly }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/timeliness-monitoring.html' %}
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'js/echarts.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/chart-sparkline.js' %}" type="text/javascript"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
title: {
text: '更新次数/天'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['微信', '微博', '头条', '抖音', '其他']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
yAxis: {
type: 'value'
},
series: [
{
name: '微信',
type: 'line',
stack: '总量',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '微博',
type: 'line',
stack: '总量',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '头条',
type: 'line',
stack: '总量',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '抖音',
type: 'line',
stack: '总量',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '其他',
type: 'line',
stack: '总量',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
{% endblock %}

View File

@ -0,0 +1,208 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<div class="page-container row-fluid">
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<section id="main-content" class=" ">
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
{% if messages %}
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% for message in messages %}
{{ message }}.<br/>
{% endfor %}
</div>
{% endif %}
</section>
<div class="panel">
<div class="panel-body">
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">新媒体数量</h4>
<p class="list-group-item-text">{{ new_media_count }}</p>
<p class="list-group-item-text">本周新增{{ new_media_count_week }}</p>
<p class="list-group-item-text">本月新增{{ new_media_count_month }}</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">内容更新次数</h4>
<p class="list-group-item-text">{{ update_count }}</p>
<p class="list-group-item-text">本周新增次数0</p>
<p class="list-group-item-text">本月新增次数0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">评论数量</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">错别字</h4>
<p class="list-group-item-text">{{ wrongly_count }}</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">敏感词</h4>
<p class="list-group-item-text">0</p>
<p class="list-group-item-text">本周新增0</p>
<p class="list-group-item-text">本月新增0</p>
</a>
</div>
<div class="list-group col-md-2 ">
<a href="#" class="list-group-item active" style="text-align: center">
<h4 class="list-group-item-heading">主体数量</h4>
<p class="list-group-item-text">{{ organization_count }}</p>
<p class="list-group-item-text">本周新增{{ organization_count_week }}</p>
<p class="list-group-item-text">本月新增{{ organization_count_month }}</p>
</a>
</div>
</div>
<div class="panel-body">
<div id="main" style="width: 100%;height:400px;"></div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation"><a
href="{% url 'monitor-timeliness-monitoring-weixin' %}">微信</a></li>
<li role="presentation"><a
href="{% url 'monitor-timeliness-monitoring-toutiao' %}">头条</a></li>
<li role="presentation" class="active"><a href="{% url 'monitor-timeliness-monitoring-weibo' %}">微博</a>
</li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-douyin' %}">抖音</a>
</li>
<li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-qita' %}">其他</a>
</li>
</ul>
</div>
<table class="table table-hover" style="font-size: 14px">
<thead>
<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>
</tr>
</thead>
<tbody>
{% for r in res %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.n_name }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.start_data }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.silet }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">{{ r.wrongly }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/timeliness-monitoring.html' %}
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}
{% block add_js %}
<script src="{% static 'js/echarts.min.js' %}" type="text/javascript"></script>
<script src="{% static 'js/chart-sparkline.js' %}" type="text/javascript"></script>
<script type="text/javascript">
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
option = {
title: {
text: '更新次数/天'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['微信', '微博', '头条', '抖音', '其他']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
},
yAxis: {
type: 'value'
},
series: [
{
name: '微信',
type: 'line',
stack: '总量',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '微博',
type: 'line',
stack: '总量',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '头条',
type: 'line',
stack: '总量',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '抖音',
type: 'line',
stack: '总量',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '其他',
type: 'line',
stack: '总量',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
</script>
{% endblock %}

View File

@ -34,24 +34,24 @@
<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">{{ update_count }}</p> <p class="list-group-item-text">{{ update_count }}</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" 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" 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">{{ wrongly_count }}</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 ">
@ -65,9 +65,9 @@
<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">{{ organization_count }}</p>
<p class="list-group-item-text">本周新增</p> <p class="list-group-item-text">本周新增{{ organization_count_week }}</p>
<p class="list-group-item-text">本月新增</p> <p class="list-group-item-text">本月新增{{ organization_count_month }}</p>
</a> </a>
</div> </div>
</div> </div>
@ -79,14 +79,14 @@
<div class="panel-heading"> <div class="panel-heading">
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<li role="presentation" class="active"><a <li role="presentation" class="active"><a
href="">微信</a></li> href="{% url 'monitor-timeliness-monitoring-weixin' %}">微信</a></li>
<li role="presentation"><a <li role="presentation"><a
href="">头条</a></li> href="{% url 'monitor-timeliness-monitoring-toutiao' %}">头条</a></li>
<li role="presentation"><a href="">微博</a> <li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-weibo' %}">微博</a>
</li> </li>
<li role="presentation"><a href="">抖音</a> <li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-douyin' %}">抖音</a>
</li> </li>
<li role="presentation"><a href="">其他</a> <li role="presentation"><a href="{% url 'monitor-timeliness-monitoring-qita' %}">其他</a>
</li> </li>
</ul> </ul>
</div> </div>
@ -94,6 +94,7 @@
<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>
@ -104,20 +105,24 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for r in res %}
<tr> <tr>
<td style="vertical-align: middle;text-align: center">{{ r.code }}</td> <td style="vertical-align: middle;text-align: center">{{ r.n_name }}</td>
<td style="vertical-align: middle;text-align: center"><img src="{{ r.image.url }}"
style="width: 40px;height: 40px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ r.count }}</td> <td style="vertical-align: middle;text-align: center">{{ r.count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.count_jc }}</td> <td style="vertical-align: middle;text-align: center">{{ r.start_data }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.comment }}</td> <td style="vertical-align: middle;text-align: center">{{ r.silet }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.reply }}</td> <td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td> <td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td> <td style="vertical-align: middle;text-align: center">{{ r.wrongly }}</td>
<td style="vertical-align: middle;text-align: center">0</td>
<td style="vertical-align: middle;text-align: center">0</td>
</tr> </tr>
{% endfor %}
</tbody> </tbody>
</table> </table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/timeliness-monitoring.html' %}
</div>
</div> </div>
</div> </div>
</section> </section>

View File

@ -10,7 +10,11 @@ urlpatterns = [
path('new/media/public/opinion/douyin/',views.new_media_public_opinion_douyin,name='monitor-new-media-public-opinion-douyin'), path('new/media/public/opinion/douyin/',views.new_media_public_opinion_douyin,name='monitor-new-media-public-opinion-douyin'),
path('new/media/public/opinion/qita/',views.new_media_public_opinion_qita,name='monitor-new-media-public-opinion-qita'), path('new/media/public/opinion/qita/',views.new_media_public_opinion_qita,name='monitor-new-media-public-opinion-qita'),
#时效性监测 #时效性监测
path('timeliness/monitoring/',views.timeliness_monitoring,name='monitor-timeliness-monitoring'), path('timeliness/monitoring/weixin/',views.timeliness_monitoring_weixin,name='monitor-timeliness-monitoring-weixin'),
path('timeliness/monitoring/weibo/',views.timeliness_monitoring_weibo,name='monitor-timeliness-monitoring-weibo'),
path('timeliness/monitoring/toutiao/',views.timeliness_monitoring_toutiao,name='monitor-timeliness-monitoring-toutiao'),
path('timeliness/monitoring/douyin/',views.timeliness_monitoring_douyin,name='monitor-timeliness-monitoring-douyin'),
path('timeliness/monitoring/qita/',views.timeliness_monitoring_qita,name='monitor-timeliness-monitoring-qita'),
#错别字监测 #错别字监测
path('error/monitoring/',views.error_monitoring,name='monitor-error-monitoring'), path('error/monitoring/',views.error_monitoring,name='monitor-error-monitoring'),
#敏感词监测 #敏感词监测

View File

@ -4,6 +4,7 @@ import json
from collections import Counter from collections import Counter
import jieba import jieba
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Sum 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
@ -23,7 +24,6 @@ def new_media_public_opinion_weixin(request):
o = dict() o = dict()
o['id'] = str(w.id) o['id'] = str(w.id)
o['code'] = w.weixin.code o['code'] = w.weixin.code
o['image'] = w.weixin.image
o['title'] = w.title o['title'] = w.title
o['comment'] = w.comment o['comment'] = w.comment
o['reply'] = w.reply o['reply'] = w.reply
@ -120,7 +120,7 @@ def new_media_public_opinion_qita(request):
return render(request, 'monitor/new-media-public-opinion-qita.html', {'res': res, 'qita': qita, 'group': group}) return render(request, 'monitor/new-media-public-opinion-qita.html', {'res': res, 'qita': qita, 'group': group})
def timeliness_monitoring(request): def timeliness_monitoring_weixin(request):
now = datetime.datetime.now() now = datetime.datetime.now()
# 本周第一天和最后一天 # 本周第一天和最后一天
this_week_start = now - timedelta(days=now.weekday()) this_week_start = now - timedelta(days=now.weekday())
@ -129,21 +129,370 @@ def timeliness_monitoring(request):
this_month_start = datetime.datetime(now.year, now.month, 1) 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( this_month_end = datetime.datetime(now.year, now.month + 1, 1) - timedelta(days=1) + datetime.timedelta(
hours=23, minutes=59, seconds=59) 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 = int(Weixin.objects.all().count()) + int(Weibo.objects.all().count()) + int(
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()) Toutiao.objects.all().count()) + int(Douyin.objects.all().count()) + int(Qita.objects.all().count())
# update_count = TimelinessMonitoring.objects.all().count() new_media_count_month = int(Weixin.objects.filter(created__range=(this_month_start, this_month_end)).count()) + int(
# update = TimelinessMonitoring.objects.all().aggregate(nums=Sum('update')) Weibo.objects.filter(created__range=(this_month_start, this_month_end)).count()) + int(
# update_count = update['nums'] 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']
comment_count = TimelinessMonitoring.objects.all().aggregate(nums=Sum('comment'))['nums']
# comment = TimelinessMonitoring.objects.all().aggregate(nums=Sum('comment'))
# comment_count = comment['nums']
wrongly_count = Wrongly.objects.all().count wrongly_count = Wrongly.objects.all().count
sensitive_count = None sensitive_count = None
organization_count = Organization.objects.all().count() 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()
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,'wrongly_count':wrongly_count,'organization_count':organization_count}) timelinessmonitoring = TimelinessMonitoring.objects.filter(n_type='微信').order_by('n_name')
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
o['count'] = TimelinessMonitoring.objects.filter(n_name=t.n_name).aggregate(nums=Sum('update'))['nums']
o['n_name'] = t.n_name
o['o_type'] = t.o_type
o['o_name'] = t.o_name
o['city'] = t.city
o['counties'] = t.counties
o['remark'] = t.remark
o['results'] = t.results
o['update'] = t.update
o['silet'] = t.silet
o['start_data'] = t.start_data
o['end_data'] = t.end_data
o['comment'] = t.comment
o['date'] = t.date
o['wrongly'] = Wrongly.objects.filter(n_name=t.n_name).count()
res.append(o)
return render(request, 'monitor/timeliness-monitoring-weixin.html',
{'new_media_count': new_media_count, 'new_media_count_month': new_media_count_month,
'new_media_count_week': new_media_count_week, 'wrongly_count': wrongly_count,
'organization_count': organization_count, 'update_count': update_count,
'comment_count': comment_count, 'organization_count_month': organization_count_month,
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
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)
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().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']
comment_count = TimelinessMonitoring.objects.all().aggregate(nums=Sum('comment'))['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()
timelinessmonitoring = TimelinessMonitoring.objects.filter(n_type='微博').order_by('n_name')
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
o['count'] = TimelinessMonitoring.objects.filter(n_name=t.n_name).aggregate(nums=Sum('update'))['nums']
o['n_name'] = t.n_name
o['o_type'] = t.o_type
o['o_name'] = t.o_name
o['city'] = t.city
o['counties'] = t.counties
o['remark'] = t.remark
o['results'] = t.results
o['update'] = t.update
o['silet'] = t.silet
o['start_data'] = t.start_data
o['end_data'] = t.end_data
o['comment'] = t.comment
o['date'] = t.date
o['wrongly'] = Wrongly.objects.filter(n_name=t.n_name).count()
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,
'comment_count': comment_count, 'organization_count_month': organization_count_month,
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
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)
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().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']
comment_count = TimelinessMonitoring.objects.all().aggregate(nums=Sum('comment'))['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()
timelinessmonitoring = TimelinessMonitoring.objects.filter(n_type='今日头条').order_by('n_name')
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
o['count'] = TimelinessMonitoring.objects.filter(n_name=t.n_name).aggregate(nums=Sum('update'))['nums']
o['n_name'] = t.n_name
o['o_type'] = t.o_type
o['o_name'] = t.o_name
o['city'] = t.city
o['counties'] = t.counties
o['remark'] = t.remark
o['results'] = t.results
o['update'] = t.update
o['silet'] = t.silet
o['start_data'] = t.start_data
o['end_data'] = t.end_data
o['comment'] = t.comment
o['date'] = t.date
o['wrongly'] = Wrongly.objects.filter(n_name=t.n_name).count()
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,
'comment_count': comment_count, 'organization_count_month': organization_count_month,
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
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)
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().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']
comment_count = TimelinessMonitoring.objects.all().aggregate(nums=Sum('comment'))['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()
timelinessmonitoring = TimelinessMonitoring.objects.filter(n_type__contains='抖音').order_by('n_name')
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
o['count'] = TimelinessMonitoring.objects.filter(n_name=t.n_name).aggregate(nums=Sum('update'))['nums']
o['n_name'] = t.n_name
o['o_type'] = t.o_type
o['o_name'] = t.o_name
o['city'] = t.city
o['counties'] = t.counties
o['remark'] = t.remark
o['results'] = t.results
o['update'] = t.update
o['silet'] = t.silet
o['start_data'] = t.start_data
o['end_data'] = t.end_data
o['comment'] = t.comment
o['date'] = t.date
o['wrongly'] = Wrongly.objects.filter(n_name=t.n_name).count()
res.append(o)
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,
'comment_count': comment_count, 'organization_count_month': organization_count_month,
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
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)
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().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']
comment_count = TimelinessMonitoring.objects.all().aggregate(nums=Sum('comment'))['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()
timelinessmonitoring = TimelinessMonitoring.objects.exclude(n_type__in=['微信','微博','今日头条','抖音']).order_by('n_name')
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
o['count'] = TimelinessMonitoring.objects.filter(n_name=t.n_name).aggregate(nums=Sum('update'))['nums']
o['n_name'] = t.n_name
o['o_type'] = t.o_type
o['o_name'] = t.o_name
o['city'] = t.city
o['counties'] = t.counties
o['remark'] = t.remark
o['results'] = t.results
o['update'] = t.update
o['silet'] = t.silet
o['start_data'] = t.start_data
o['end_data'] = t.end_data
o['comment'] = t.comment
o['date'] = t.date
o['wrongly'] = Wrongly.objects.filter(n_name=t.n_name).count()
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,
'comment_count': comment_count, 'organization_count_month': organization_count_month,
'organization_count_week': organization_count_week, 'res': res,
'timelinessmonitoring': timelinessmonitoring})
def error_monitoring(request): def error_monitoring(request):
@ -187,8 +536,7 @@ def comment_on_interactive_monitoring_json(request):
def monitoring_report(request): def monitoring_report(request):
news = News.objects.filter(type='3').order_by('-date') news = News.objects.filter(type='3').order_by('-date')
count = News.objects.filter(type='3').count() count = News.objects.filter(type='3').count()
return render(request, 'monitor/monitoring-report.html', {'news': news,'count':count}) return render(request, 'monitor/monitoring-report.html', {'news': news, 'count': count})
def test(request): def test(request):