This commit is contained in:
baoliang 2020-09-18 15:52:22 +08:00
commit 2d7967b990
12 changed files with 152 additions and 129 deletions

14
.gitignore vendored
View File

@ -1,7 +1,7 @@
.idea/
.venv/
.media/
*/__pycache__/
*/*.pyc
*/migrations
NewMediaMonitoring/local_settings.py
.idea/
.venv/
.media/
*/__pycache__/
*/*.pyc
*/migrations
NewMediaMonitoring/local_settings.py

View File

@ -171,7 +171,9 @@ class Weixin_data(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
title = models.CharField('文章标题', max_length=256, null=True, blank=True)
site = models.CharField('位置', max_length=256, null=True, blank=True)
date = models.DateField('发文时间', max_length=256, null=True, blank=True)
year = models.CharField('', max_length=256, null=True, blank=True)
month = models.CharField('', max_length=256, null=True, blank=True)
day = models.CharField('', max_length=256, null=True, blank=True)
original = models.BooleanField('是否原创', null=True, blank=True)
url = models.CharField('文章链接', max_length=256, null=True, blank=True)
author = models.CharField('作者', max_length=256, null=True, blank=True)
@ -235,7 +237,9 @@ class Weibo_data(models.Model):
'转发图片url', max_length=256, null=True, blank=True)
original = models.BooleanField('是否原创', null=True, blank=True)
site = models.CharField('发布位置', max_length=256, null=True, blank=True)
date = models.DateField('发布时间', max_length=256, null=True, blank=True)
year = models.CharField('', max_length=256, null=True, blank=True)
month = models.CharField('', max_length=256, null=True, blank=True)
day = models.CharField('', max_length=256, null=True, blank=True)
tool = models.CharField('发布工具', max_length=256, null=True, blank=True)
like = models.CharField('点赞数', max_length=256, null=True, blank=True)
transpond = models.CharField('转发数', max_length=256, null=True, blank=True)
@ -278,7 +282,9 @@ class Toutiao_data(models.Model):
commentcount = models.CharField(
'评论数', max_length=256, null=True, blank=True)
reply = models.CharField('作者回复数', max_length=256, null=True, blank=True)
date = models.DateField('时间', max_length=256, null=True, blank=True)
year = models.CharField('', max_length=256, null=True, blank=True)
month = models.CharField('', max_length=256, null=True, blank=True)
day = models.CharField('', max_length=256, null=True, blank=True)
content = models.TextField('正文', null=True, blank=True)
comment = models.TextField('评论', null=True, blank=True)
toutiao = models.ForeignKey(

View File

@ -28,12 +28,12 @@ def index(request):
qita_count = Qita.objects.all().count()
douyin_count = Douyin.objects.all().count()
organization_count = Organization.objects.all().count()
year = datetime.datetime.now().year
month_from = datetime.datetime.now().month
month_to = int(month_from)-1
# year = datetime.datetime.now().year
# month = datetime.datetime.now().month
# month = datetime.datetime.now().month
return render(request, 'dashboard/index.html',
{'weixin_count': weixin_count, 'weibo_count': weibo_count, 'toutiao_count': toutiao_count,
'qita_count': qita_count, 'douyin_count': douyin_count, 'organization_count': organization_count,'year':year,'month_from':month_from,'month_to':month_to})
'qita_count': qita_count, 'douyin_count': douyin_count, 'organization_count': organization_count})
def user_login(request):

View File

@ -1,41 +1,44 @@
function initChart (element,year,month_from,month_to) {
var dataCount = echarts.init(document.getElementById(element));
var dataCountOption = {
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
// left: '3%',
// right: '4%',
// bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '直接访问',
type: 'bar',
barWidth: '60%',
data: [10, 52, 200, 334, 390, 330, 220]
}
]
};
// $.get('/dashboard/spi.json?code=' + code + '&year_from=' + year_from + '&year_to=' + year_to, function (data) {
//
// }
// var dataCountOption = {
// color: ['#3398DB'],
// tooltip: {
// trigger: 'axis',
// axisPointer: { // 坐标轴指示器,坐标轴触发有效
// type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
// }
// },
// grid: {
// // left: '3%',
// // right: '4%',
// // bottom: '3%',
// containLabel: true
// },
// xAxis: [
// {
// type: 'category',
// data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
// axisTick: {
// alignWithLabel: true
// }
// }
// ],
// yAxis: [
// {
// type: 'value'
// }
// ],
// series: [
// {
// name: '直接访问',
// type: 'bar',
// barWidth: '60%',
// data: [10, 52, 200, 334, 390, 330, 220]
// }
// ]
// };
dataCount.setOption(dataCountOption)
}

View File

@ -3,7 +3,13 @@ import datetime
from django.shortcuts import render
# Create your views here.
from dashboard.models import Weixin, Weixin_data
def index_data_count_chart(request):
pass
year = request.GET.get('year')
month_form = request.GET.get('month_form')
month_to = request.GET.get('month_to')
weixin = Weixin_data.objects.filter(year=year,date__range=(month_form,month_to))

View File

@ -1,77 +1,85 @@
from django.shortcuts import render
# Create your views here.
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita
def new_media_public_opinion_weixin(request):
weixin = Weixin.objects.all()
group = Group.objects.all()
weixin_data = Weixin_data.objects.all()
res = []
for w in weixin_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weixin.code
o['image'] = w.weixin.image
o['title'] = w.title
o['comment'] = w.comment
o['reply'] = w.reply
o['date'] = w.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weixin.html', {'res':res,'weixin':weixin,'group':group})
def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all()
group = Group.objects.all()
toutiao_data = Toutiao_data.objects.all()
res = []
for t in toutiao_data:
o = dict()
o['id'] = str(t.id)
o['code'] = t.toutiao.code
o['image'] = t.toutiao.image
o['title'] = t.title
o['count'] = t.count
o['commentcount'] = t.commentcount
o['reply'] = t.reply
o['date'] = t.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-toutiao.html', {'res':res,'toutiao':toutiao,'group':group})
def new_media_public_opinion_weibo(request):
weibo = Weibo.objects.all()
group = Group.objects.all()
weibo_data = Weibo_data.objects.all()
res = []
for w in weibo_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weibo.code
o['image'] = w.weibo.image
o['title'] = w.title
o['like'] = w.like
o['transpond'] = w.transpond
o['comment'] = w.comment
o['date'] = w.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weibo.html', {'res':res,'weibo':weibo,'group':group})
def new_media_public_opinion_qita(request):
qita = Qita.objects.all()
group = Group.objects.all()
qita_jc = Qita_jc.objects.all()
res = []
for q in qita_jc:
o = dict()
o['id'] = str(q.id)
o['type'] = q.qita.type
o['name'] = q.qita.name
o['image'] = q.qita.image
o['count'] = q.count
o['count_jc'] = q.count_jc
o['comment'] = q.comment
o['reply'] = q.reply
o['date'] = q.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-qita.html', {'res':res,'qita':qita,'group':group})
from django.shortcuts import render
# Create your views here.
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita
def new_media_public_opinion_weixin(request):
weixin = Weixin.objects.all()
group = Group.objects.all()
weixin_data = Weixin_data.objects.all()
res = []
for w in weixin_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weixin.code
o['image'] = w.weixin.image
o['title'] = w.title
o['comment'] = w.comment
o['reply'] = w.reply
o['year'] = w.year
o['month'] = w.month
o['day'] = w.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weixin.html', {'res':res,'weixin':weixin,'group':group})
def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all()
group = Group.objects.all()
toutiao_data = Toutiao_data.objects.all()
res = []
for t in toutiao_data:
o = dict()
o['id'] = str(t.id)
o['code'] = t.toutiao.code
o['image'] = t.toutiao.image
o['title'] = t.title
o['count'] = t.count
o['commentcount'] = t.commentcount
o['reply'] = t.reply
o['year'] = t.year
o['month'] = t.month
o['day'] = t.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-toutiao.html', {'res':res,'toutiao':toutiao,'group':group})
def new_media_public_opinion_weibo(request):
weibo = Weibo.objects.all()
group = Group.objects.all()
weibo_data = Weibo_data.objects.all()
res = []
for w in weibo_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weibo.code
o['image'] = w.weibo.image
o['title'] = w.title
o['like'] = w.like
o['transpond'] = w.transpond
o['comment'] = w.comment
o['year'] = w.year
o['month'] = w.month
o['day'] = w.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weibo.html', {'res':res,'weibo':weibo,'group':group})
def new_media_public_opinion_qita(request):
qita = Qita.objects.all()
group = Group.objects.all()
qita_jc = Qita_jc.objects.all()
res = []
for q in qita_jc:
o = dict()
o['id'] = str(q.id)
o['type'] = q.qita.type
o['name'] = q.qita.name
o['image'] = q.qita.image
o['count'] = q.count
o['count_jc'] = q.count_jc
o['comment'] = q.comment
o['reply'] = q.reply
o['year'] = q.year
o['month'] = q.month
o['day'] = q.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-qita.html', {'res':res,'qita':qita,'group':group})

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB