#add message

This commit is contained in:
xieshen 2020-11-18 15:48:17 +08:00
parent bfe195b0cc
commit f86836919b
24 changed files with 627 additions and 229 deletions

View File

@ -0,0 +1,60 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<!-- START TOPBAR -->
<!-- START CONTAINER -->
<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="chatapi-windows "></div>
<div class="panel panel-default">
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">评论数据录入</div>
<div class="panel panel-default">
<!-- Default panel contents -->
<form action="{% url 'backstage-comment' %}" method="post"
enctype="multipart/form-data">{% csrf_token %}
{# <div class="form-group col-md-4">#}
{# <label for="date">时间</label>#}
{# <input type="date" class="form-control" id="source"#}
{# name="date">#}
{# </div>#}
<div class="form-group">
<label for="exampleInputFile">点击上传文件</label>
<input type="file" id="exampleInputFile" name="file">
<p class="help-block">请上传csv文件(文件表头依次为评论、回复、新媒体名称、标题、时间、文章链接。时间格式为2020/11/17)</p>
</div>
<button type="submit" class="btn btn-success">点击上传</button>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}

View File

@ -0,0 +1,60 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<!-- START TOPBAR -->
<!-- START CONTAINER -->
<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="chatapi-windows "></div>
<div class="panel panel-default">
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">错别字数据录入</div>
<div class="panel panel-default">
<!-- Default panel contents -->
<form action="{% url 'backstage-error' %}" method="post"
enctype="multipart/form-data">{% csrf_token %}
{# <div class="form-group col-md-4">#}
{# <label for="date">时间</label>#}
{# <input type="date" class="form-control" id="source"#}
{# name="date">#}
{# </div>#}
<div class="form-group">
<label for="exampleInputFile">点击上传文件</label>
<input type="file" id="exampleInputFile" name="file">
<p class="help-block">请上传csv文件(文件表头依次为错误、建议、定位、新媒体类型、账号、发文时间、标题、市、监测时间。时间格式为2020/11/17)</p>
</div>
<button type="submit" class="btn btn-success">点击上传</button>
</form>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}

View File

@ -6,4 +6,5 @@ from backstage import views
urlpatterns = [
path('backstage/newmedia/public/opinion/',views.backstage_new_media_public_opinion,name='backstage-new-media-public-opinion'),
path('backstage/error/',views.backstage_error,name='backstage-error'),
path('backstage/comment/',views.backstage_comment,name='backstage-comment'),
]

View File

@ -9,7 +9,7 @@ from django.shortcuts import render
# Create your views here.
from NewMediaMonitoring import settings
from dashboard.models import TimelinessMonitoring
from dashboard.models import TimelinessMonitoring, Wrongly, Comment
def backstage_new_media_public_opinion(request):
@ -40,7 +40,6 @@ def backstage_new_media_public_opinion(request):
# messages.error(request, '请上传正确的时间格式!!!')
# return HttpResponseRedirect('/backstage/backstage/newmedia/public/opinion/')
try:
if v[8] != '更新次数':
# if v[8].isdigit():
@ -76,5 +75,74 @@ def backstage_new_media_public_opinion(request):
return render(request, 'backstage/backstage_new_media_public_opinion.html')
def backstage_error(resquest):
pass
def backstage_error(request):
if request.method == 'POST':
filename = request.FILES.get('file')
if not os.path.exists(settings.MEDIA_ROOT):
os.makedirs(settings.MEDIA_ROOT)
if filename is None:
messages.error(request, '请选择要上传的文件!!!')
return HttpResponseRedirect('/backstage/backstage/error/')
if str(filename).split('.')[1] == 'csv':
data = filename.read().decode("utf-8")
line = str(data).split('\n')
for l in line:
v = l.split(',')
try:
if v[0] != '错误':
print(v[0])
error = v[0]
idea = v[1]
site = v[2]
n_type = v[3]
n_name = v[4]
date = v[5]
title = v[6]
city = v[7]
jc_date = v[8]
wrongly = Wrongly(error=error, idea=idea, site=site, n_type=n_type, n_name=n_name, date=date,
title=title, city=city, jc_date=jc_date)
wrongly.save()
except:
print(v)
else:
messages.error(request, '请上传正确的文件类型!!!')
return HttpResponseRedirect('/backstage/backstage/error/')
return render(request, 'backstage/backstage-error.html')
def backstage_comment(request):
if request.method == 'POST':
filename = request.FILES.get('file')
if not os.path.exists(settings.MEDIA_ROOT):
os.makedirs(settings.MEDIA_ROOT)
if filename is None:
messages.error(request, '请选择要上传的文件!!!')
return HttpResponseRedirect('/backstage/backstage/comment/')
if str(filename).split('.')[1] == 'csv':
data = filename.read().decode("utf-8")
line = str(data).split('\n')
for l in line:
v = l.split(',')
try:
if v[0] != '评论':
print(v[0])
comment = v[0]
reply = v[1]
name = v[2]
title = v[3]
date = v[4]
url = v[5]
comment = Comment(comment=comment, reply=reply, name=name, title=title, date=date, url=url)
comment.save()
except:
print(v)
else:
messages.error(request, '请上传正确的文件类型!!!')
return HttpResponseRedirect('/backstage/backstage/comment/')
return render(request, 'backstage/backstage-comment.html')

View File

@ -762,10 +762,25 @@ class Wrongly(models.Model):
n_name = models.CharField('新媒体名称', max_length=256, null=True, blank=True)
date = models.CharField('发布时间', max_length=256, null=True, blank=True)
title = models.CharField('标题', max_length=256, null=True, blank=True)
url = models.CharField('URL', max_length=256, null=True, blank=True)
city = models.CharField('', max_length=256, null=True, blank=True)
jc_date = models.CharField('监测时间', max_length=256, null=True, blank=True)
def __str__(self):
return self.title
#时效性监测文件存储表
#评论临时表
class Comment(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
comment = models.TextField('评论', null=True, blank=True)
user = models.CharField('用户', max_length=256, null=True, blank=True)
reply = models.TextField('回复', null=True, blank=True)
name = models.CharField('新媒体名称',max_length=256, null=True, blank=True)
title = models.CharField('标题',max_length=256, null=True, blank=True)
date = models.CharField('时间',max_length=256, null=True, blank=True)
url = models.CharField('文章链接',max_length=256, null=True, blank=True)
created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True)
def __str__(self):
return self.user

View File

@ -165,6 +165,8 @@
<span class="title">系统设置</span>
</a>
</li>
{% for u in user.userprofile_set.all %}
{% if u.organization.level.level == 9 %}
<li {% if url_name|startswith:'backstag' %}class="open" {% endif %}>
<a href="javascript:;">
<i class="fa fa-sliders"></i>
@ -176,19 +178,18 @@
<a {% if url_name == 'backstage-new-media-public-opinion' %} class="active" {% endif %}
href="{% url 'backstage-new-media-public-opinion' %}">时效性监测</a>
</li>
{# <li>#}
{# <a {% if url_name == 'group-management-management-init' %} class="active" {% endif %}#}
{# href="{% url 'group-management-management-init' %}">错别字</a>#}
{# </li>#}
{# <li>#}
{# <a {% if url_name == 'group-management-management-init' %} class="active" {% endif %}#}
{# href="{% url 'group-management-management-init' %}">时效性监测</a>#}
{# </li>#}
{# <li>#}
{# <a class="" href="">搜索添加单位</a>#}
{# </li>#}
<li>
<a {% if url_name == 'backstage-error' %} class="active" {% endif %}
href="{% url 'backstage-error' %}">错别字</a>
</li>
<li>
<a {% if url_name == 'backstage-comment' %} class="active" {% endif %}
href="{% url 'backstage-comment' %}">评论</a>
</li>
</ul>
</li>
{% endif %}
{% endfor %}
{# <li class="">#}
{# <a href="javascript:;">#}
{# <i class="fa fa-columns"></i>#}

View File

@ -372,6 +372,36 @@
$.getJSON('/monitor/index/newmedia/count/', function (res) {
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('left2'));
var weixin = res.weixin
for (var i = 0; i < weixin.length; i++) {
if (weixin[i] != '3099') {
weixin[i] = 3099 + weixin[i]
}
}
var weibo = res.weibo
for (var i = 0; i < weibo.length; i++) {
if (weibo[i] != '774') {
weibo[i] = 774 + weibo[i]
}
}
var toutiao = res.toutiao
for (var i = 0; i < toutiao.length; i++) {
if (toutiao[i] != '615') {
toutiao[i] = 615 + toutiao[i]
}
}
var douyin = res.douyin
for (var i = 0; i < douyin.length; i++) {
if (douyin[i] != '451') {
douyin[i] = 451 + douyin[i]
}
}
var qita = res.qita
for (var i = 0; i < qita.length; i++) {
if (qita[i] != '295') {
qita[i] = 295 + qita[i]
}
}
option = {
{#title: {#}
{# text: '新媒体数量/时间',#}
@ -407,31 +437,31 @@
name: '微信',
type: 'line',
stack: '总量',
data: res.weixin
data: weixin
},
{
name: '微博',
type: 'line',
stack: '总量',
data: res.weibo
data: weibo
},
{
name: '今日头条',
type: 'line',
stack: '总量',
data: res.toutiao
data: toutiao
},
{
name: '抖音',
type: 'line',
stack: '总量',
data: res.douyin
data: douyin
},
{
name: '其他',
type: 'line',
stack: '总量',
data: res.qita
data: qita
}
]
};
@ -441,45 +471,118 @@
$.getJSON('/monitor/index/warning/count/', function (res) {
// 基于准备好的dom初始化echarts实例
var myChart = echarts.init(document.getElementById('left3'));
option = {
{#option = {#}
{#title: {#}
{# text: '新媒体数量/时间',#}
{# },#}
{# tooltip: {#}
{# trigger: 'axis'#}
{# },#}
{# legend: {#}
{# data: ['预警']#}
{# },#}
{# grid: {#}
{# left: '3%',#}
{# right: '6%',#}
{# bottom: '1%',#}
{# top: '20px',#}
{# containLabel: true#}
{# },#}
{# toolbox: {#}
{# feature: {#}
{# saveAsImage: {}#}
{# }#}
{# },#}
{# xAxis: {#}
{# type: 'category',#}
{# boundaryGap: false,#}
{# data: res.date_list#}
{# },#}
{# yAxis: {#}
{# type: 'value'#}
{# },#}
{# series: [#}
{# {#}
{# name: '预警',#}
{# type: 'line',#}
{# stack: '总量',#}
{# data: res.data#}
{# }#}
{# ]#}
{# };#}
option = {
tooltip: {
trigger: 'axis'
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
toolbox: {
feature: {
{#dataView: {show: true, readOnly: false},#}
magicType: {show: true, type: ['line', 'bar']},
{#restore: {show: true},#}
{#saveAsImage: {show: true}#}
}
},
legend: {
data: ['预警']
data: ['监测报告', '预警账号']
},
grid: {
left: '3%',
right: '6%',
bottom: '1%',
top: '20px',
top: '17px',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
xAxis: [
{
type: 'category',
boundaryGap: false,
data: res.date_list
},
yAxis: {
type: 'value'
data: res.date_list,
axisPointer: {
type: 'shadow'
}
}
],
yAxis: [
{
type: 'value',
name: '监测报告',
min: 0,
max: 1,
interval: 1,
{#axisLabel: {#}
{# formatter: '{value} ml'#}
{# }#}
},
{
type: 'value',
name: '预警账号',
min: 0,
max: 25,
interval: 25
{#axisLabel: {#}
{# formatter: '{value} °C'#}
{# }#}
}
],
series: [
{
name: '预警',
type: 'line',
stack: '总量',
name: '监测报告',
type: 'bar',
data: res.data
},
{
name: '预警账号',
type: 'bar',
data: res.data
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
})

View File

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

View File

@ -35,8 +35,11 @@ def refresh_captcha(request):
to_json_response['new_cptch_image'] = captcha_image_url(to_json_response['new_cptch_key'])
return JsonResponse(to_json_response)
def home(request):
return render(request, 'dashboard/home.html')
def index(request):
weixin_count = Weixin.objects.all().count()
weibo_count = Weibo.objects.all().count()
@ -419,6 +422,8 @@ def import_user(request):
except:
print(phone)
return HttpResponse('ok')
@login_required
def user_search_by_keyword(request):
user = request.user
@ -433,23 +438,29 @@ def user_search_by_keyword(request):
userpaginator = None
if level == 1:
if keytype == '1':
userpaginator = Userprofile.objects.filter(name__contains=keyword,userprofile__organization__province=province)
userpaginator = Userprofile.objects.filter(name__contains=keyword,
userprofile__organization__province=province)
elif keytype == '2':
userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,userprofile__organization__province=province)
userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,
userprofile__organization__province=province)
elif level == 2:
if keytype == '1':
userpaginator = Userprofile.objects.filter(name__contains=keyword,userprofile__organization__province=province,
userpaginator = Userprofile.objects.filter(name__contains=keyword,
userprofile__organization__province=province,
userprofile__organization__cities=cities)
elif keytype == '2':
userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,userprofile__organization__province=province,
userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,
userprofile__organization__province=province,
userprofile__organization__cities=cities)
elif level == 3:
if keytype == '1':
userpaginator = Userprofile.objects.filter(name__contains=keyword,userprofile__organization__province=province,
userpaginator = Userprofile.objects.filter(name__contains=keyword,
userprofile__organization__province=province,
userprofile__organization__cities=cities,
userprofile__organization__district=district)
elif keytype == '2':
userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,userprofile__organization__province=province,
userpaginator = Userprofile.objects.filter(organization__name__contains=keyword,
userprofile__organization__province=province,
userprofile__organization__cities=cities,
userprofile__organization__district=district)
elif level == 9:
@ -466,6 +477,7 @@ def user_search_by_keyword(request):
# userpaginator = paginator.page(1)
# except EmptyPage:
# userpaginator = paginator.page(paginator.num_pages)
if userpaginator:
user_count = userpaginator.count()
userallinfo = []
for u in userpaginator[:30]:
@ -521,6 +533,7 @@ def user_search_by_keyword(request):
return render(request, 'management/user-management.html',
{'userallinfo': userallinfo, 'userpaginator': userpaginator, 'user_count': user_count})
@login_required
def news_search_by_keyword(request):
keytype = request.POST.get('keytype')
@ -541,6 +554,8 @@ def news_search_by_keyword(request):
news = News.objects.filter(type='5', title__contains=keyword)
elif keytype == '7':
news = News.objects.filter(type='6', title__contains=keyword)
elif keytype == '0':
news = News.objects.filter(title__contains=keyword)
news_list = []
news_count = news.count()
for n in news[:30]:
@ -567,6 +582,7 @@ def news_search_by_keyword(request):
return render(request, 'management/news-management.html',
{'news': news_list, 'new': news, 'news_count': news_count})
@login_required
def organization_search_by_keyword(request):
keytype = request.POST.get('keytype')
@ -586,10 +602,12 @@ def organization_search_by_keyword(request):
organization = Organization.objects.filter(province=province, name__contains=keyword).order_by('-created')
elif level == 2:
if keytype == '1':
organization = Organization.objects.filter(province=province, cities=cities,name__contains=keyword).order_by('-created')
organization = Organization.objects.filter(province=province, cities=cities,
name__contains=keyword).order_by('-created')
elif level == 3:
if keytype == '1':
organization = Organization.objects.filter(province=province, cities=cities, district=district,name__contains=keyword).order_by(
organization = Organization.objects.filter(province=province, cities=cities, district=district,
name__contains=keyword).order_by(
'-created')
elif level == 9:
if keytype == '1':
@ -628,7 +646,9 @@ def organization_search_by_keyword(request):
organization_id=i.id).count()
res.append(o)
return render(request, 'management/organization-management.html', {"organization": organization, 'res': res,'organization_count':organization_count})
return render(request, 'management/organization-management.html',
{"organization": organization, 'res': res, 'organization_count': organization_count})
@login_required
def weixin_search_by_keyword(request):
@ -646,13 +666,16 @@ def weixin_search_by_keyword(request):
if keytype == '1':
weixin = Weixin.objects.filter(organization__province=province, code__contains=keyword).order_by('-created')
elif keytype == '2':
weixin = Weixin.objects.filter(organization__province=province, organization__name__contains=keyword).order_by('-created')
weixin = Weixin.objects.filter(organization__province=province,
organization__name__contains=keyword).order_by('-created')
elif level == 2:
if keytype == '1':
weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities,code__contains=keyword).order_by(
weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities,
code__contains=keyword).order_by(
'-created')
elif keytype == '2':
weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities, organization__name__contains=keyword).order_by(
weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities,
organization__name__contains=keyword).order_by(
'-created')
elif level == 3:
if keytype == '1':
@ -661,7 +684,8 @@ def weixin_search_by_keyword(request):
'-created')
elif keytype == '2':
weixin = Weixin.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district, organization__name__contains=keyword).order_by(
organization__district=district,
organization__name__contains=keyword).order_by(
'-created')
elif level == 9:
if keytype == '1':
@ -707,7 +731,10 @@ def weixin_search_by_keyword(request):
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
o['status'] = w.status
res.append(o)
return render(request, 'management/newmedia-management-edit-weixin.html', {'weixin': weixin, 'res': res,'weixin_count':weixin_count})
return render(request, 'management/newmedia-management-edit-weixin.html',
{'weixin': weixin, 'res': res, 'weixin_count': weixin_count})
@login_required
def weibo_search_by_keyword(request):
keytype = request.POST.get('keytype')
@ -724,19 +751,23 @@ def weibo_search_by_keyword(request):
if keytype == '1':
weibo = Weibo.objects.filter(organization__province=province, code__contains=keyword).order_by('-created')
elif keytype == '2':
weibo = Weibo.objects.filter(organization__province=province, organization__name__contains=keyword).order_by('-created')
weibo = Weibo.objects.filter(organization__province=province,
organization__name__contains=keyword).order_by('-created')
elif level == 2:
if keytype == '1':
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,code__contains=keyword).order_by('-created')
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,
code__contains=keyword).order_by('-created')
elif keytype == '2':
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,organization__name__contains=keyword).order_by('-created')
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,
organization__name__contains=keyword).order_by('-created')
elif level == 3:
if keytype == '1':
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district, code__contains=keyword).order_by('-created')
elif keytype == '2':
weibo = Weibo.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district,organization__name__contains=keyword).order_by('-created')
organization__district=district,
organization__name__contains=keyword).order_by('-created')
elif level == 9:
if keytype == '1':
weibo = Weibo.objects.filter(code__contains=keyword).order_by('-created')
@ -780,7 +811,9 @@ def weibo_search_by_keyword(request):
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
o['status'] = w.status
res.append(o)
return render(request, 'management/newmedia-management-edit-weibo.html', {'weibo': weibo, 'res': res,'weibo_count':weibo_count})
return render(request, 'management/newmedia-management-edit-weibo.html',
{'weibo': weibo, 'res': res, 'weibo_count': weibo_count})
@login_required
def toutiao_search_by_keyword(request):
@ -796,7 +829,8 @@ def toutiao_search_by_keyword(request):
res = []
if level == 1:
if keytype == '1':
toutiao = Toutiao.objects.filter(organization__province=province, code__contains=keyword).order_by('-created')
toutiao = Toutiao.objects.filter(organization__province=province, code__contains=keyword).order_by(
'-created')
elif keytype == '2':
toutiao = Toutiao.objects.filter(organization__province=province,
organization__name__contains=keyword).order_by('-created')
@ -810,7 +844,8 @@ def toutiao_search_by_keyword(request):
elif level == 3:
if keytype == '1':
toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district, code__contains=keyword).order_by('-created')
organization__district=district, code__contains=keyword).order_by(
'-created')
elif keytype == '2':
toutiao = Toutiao.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district,
@ -858,7 +893,9 @@ def toutiao_search_by_keyword(request):
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
o['status'] = w.status
res.append(o)
return render(request, 'management/newmedia-management-edit-toutiao.html', {'toutiao': toutiao, 'res': res,'toutiao_count':toutiao_count})
return render(request, 'management/newmedia-management-edit-toutiao.html',
{'toutiao': toutiao, 'res': res, 'toutiao_count': toutiao_count})
@login_required
def douyin_search_by_keyword(request):
@ -939,6 +976,7 @@ def douyin_search_by_keyword(request):
return render(request, 'management/newmedia-management-edit-douyin.html',
{'douyin': douyin, 'res': res, 'douyin_count': douyin_count})
@login_required
def qita_search_by_keyword(request):
keytype = request.POST.get('keytype')
@ -955,12 +993,15 @@ def qita_search_by_keyword(request):
if keytype == '1':
qita = Qita.objects.filter(organization__province=province, code__contains=keyword).order_by('-created')
elif keytype == '2':
qita = Qita.objects.filter(organization__province=province,organization__name__contains=keyword).order_by('-created')
qita = Qita.objects.filter(organization__province=province, organization__name__contains=keyword).order_by(
'-created')
elif level == 2:
if keytype == '1':
qita = Qita.objects.filter(organization__province=province, organization__cities=cities,code__contains=keyword).order_by('-created')
qita = Qita.objects.filter(organization__province=province, organization__cities=cities,
code__contains=keyword).order_by('-created')
elif keytype == '2':
qita = Qita.objects.filter(organization__province=province, organization__cities=cities,organization__name__contains=keyword).order_by(
qita = Qita.objects.filter(organization__province=province, organization__cities=cities,
organization__name__contains=keyword).order_by(
'-created')
elif level == 3:
if keytype == '1':
@ -968,7 +1009,8 @@ def qita_search_by_keyword(request):
organization__district=district, code__contains=keyword).order_by('-created')
elif keytype == '2':
qita = Qita.objects.filter(organization__province=province, organization__cities=cities,
organization__district=district,organization__name__contains=keyword).order_by('-created')
organization__district=district, organization__name__contains=keyword).order_by(
'-created')
elif level == 9:
if keytype == '1':
qita = Qita.objects.filter(code__contains=keyword).order_by('-created')
@ -1013,7 +1055,9 @@ def qita_search_by_keyword(request):
o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name)
o['status'] = w.status
res.append(o)
return render(request, 'management/newmedia-management-edit-qita.html', {'qita': qita, 'res': res,'qita_count':qita_count})
return render(request, 'management/newmedia-management-edit-qita.html',
{'qita': qita, 'res': res, 'qita_count': qita_count})
@login_required
def group_init_search_by_keyword(request):
@ -1042,6 +1086,7 @@ def group_init_search_by_keyword(request):
return render(request, 'management/group-management-init.html',
{'group': group_initer, 'res_g_i': res_g_i, 'init_count': init_count, 'level': level})
@login_required
def group_admin_search_by_keyword(request):
keytype = request.POST.get('keytype')
@ -1072,6 +1117,7 @@ def group_admin_search_by_keyword(request):
return render(request, 'management/group-management-admin.html',
{'group': group_admin_list, 'res_g_a': res_g_a, 'admin_count': admin_count, 'level': level})
@login_required
def group_user_search_by_keyword(request):
keytype = request.POST.get('keytype')
@ -1101,6 +1147,7 @@ def group_user_search_by_keyword(request):
return render(request, 'management/group-management-user.html',
{'group': group_user_list, 'res_g_u': res_g_u, 'user_count': user_count, 'level': level})
@login_required
def group_super_search_by_keyword(request):
keytype = request.POST.get('keytype')
@ -1127,6 +1174,7 @@ def group_super_search_by_keyword(request):
return render(request, 'management/group-management-superuser.html',
{'group': group, 'res_g_i': res_g_i, 'count': count, 'level': level})
def app_download(request):
file = open('/var/www/p3/newmediamonitoring/media/app-10.apk', 'rb')
response = HttpResponse(file)

View File

@ -113,9 +113,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/group-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/group-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -113,9 +113,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/group-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/group-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -113,9 +113,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/group-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/group-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -106,9 +106,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/group-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/group-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -82,9 +82,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/douyin-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/douyin-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -85,9 +85,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/qita-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/qita-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -82,9 +82,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/toutiao-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/toutiao-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -83,9 +83,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/weibo-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/weibo-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -82,9 +82,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/weixin-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/weixin-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -45,6 +45,7 @@
<form method="post" action="{% url 'news-search-by-keyword' %}">{% csrf_token %}
<div class="btn-group col-md-2 title" style="display: inline-block;margin-left: 5%">
<select class="form-control" name="keytype">
<option value="0">全部</option>
<option value="1">政策依据</option>
<option value="2">基层动态</option>
<option value="3">外省动态</option>
@ -106,9 +107,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/news-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/news-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -105,9 +105,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/organization-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/organization-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -78,9 +78,9 @@
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/user-management-paginate.html' %}
</div>
{# <div class="metadata-pagination">#}
{# {% include 'dashboard/paginator/user-management-paginate.html' %}#}
{# </div>#}
</div>
</div>
</div>

View File

@ -35,23 +35,30 @@
<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 c in comment %}
<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">{{ c.comment }}</td>
{# <td style="vertical-align: middle;text-align: center">{{ c.reply }}</td>#}
<td style="vertical-align: middle;text-align: center">{{ c.name }}</td>
<td style="vertical-align: middle;text-align: center">{{ c.title }}</td>
<td style="vertical-align: middle;text-align: center">{{ c.date }}</td>
<td style="vertical-align: middle;text-align: center">{{ c.url }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="metadata-pagination">
{% include 'dashboard/paginator/comment-management-paginate.html' %}
</div>
</div>
</div>

View File

@ -127,12 +127,12 @@
legend: {
orient: 'vertical',
left: 10,
data: ['预警数']
data: ['预警账号数']
},
color: ['orange'],
series: [
{
name: '预警数',
name: '预警账号数',
type: 'pie',
radius: ['60%', '70%'],
avoidLabelOverlap: false,
@ -151,7 +151,7 @@
show: false
},
data: [
{value: 1, name: '预警数6'},
{value: 1, name: '预警账号数6'},
]
}
]

View File

@ -14,7 +14,7 @@ from datetime import timedelta
from django.views.decorators.csrf import csrf_exempt
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita, \
Douyin, Douyin_data, News, TimelinessMonitoring, Organization, Wrongly, NewMedia
Douyin, Douyin_data, News, TimelinessMonitoring, Organization, Wrongly, NewMedia, Comment
from monitor.models import Test
import pandas as pd
@ -519,14 +519,23 @@ def sensitive_word_monitoring(request):
@login_required
def comment_on_interactive_monitoring(request):
return render(request, 'monitor/comment-on-interactive-monitoring.html')
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)
return render(request, 'monitor/comment-on-interactive-monitoring.html',{"comment":comment})
@login_required
def comment_on_interactive_monitoring_json(request):
data = Test.objects.all()[:100]
data = Comment.objects.all()
r = []
for d in data:
content = d.content
content = d.comment
r.append(content)
# result = jieba.analyse.textrank(content, topK=400, withWeight=True)
seg_list = jieba.cut(str(r)) # 对文本进行分词
@ -535,7 +544,7 @@ def comment_on_interactive_monitoring_json(request):
if len(x) > 1 and x != '\r\n':
c[x] += 1
res = []
for (k, v) in c.most_common(200): # 遍历输出高频词
for (k, v) in c.most_common(250): # 遍历输出高频词
# print('%s%s %s %d' % (' ' * (5 - len(k)), k, '*', v))
# 剔除不是汉字的值
if all(map(lambda c: '\u4e00' <= c <= '\u9fa5', k)):
@ -1160,6 +1169,13 @@ def index_warning_count(request):
news = News.objects.filter(type='3',date=d).count()
data.append(news)
print(str(data)+"6666666666666666666666666666666")
# date = News.objects.distinct('date')
# data = []
# date_list = []
# for d in date:
# date_list.append(d.date)
# news = News.objects.filter(type='3', date=d).count()
# data.append(news)
return HttpResponse(json.dumps({
"status":"1",
"data":data,