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

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

@ -17,7 +17,9 @@ def new_media_public_opinion_weixin(request):
o['title'] = w.title
o['comment'] = w.comment
o['reply'] = w.reply
o['date'] = w.date
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})
@ -35,7 +37,9 @@ def new_media_public_opinion_toutiao(request):
o['count'] = t.count
o['commentcount'] = t.commentcount
o['reply'] = t.reply
o['date'] = t.date
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})
@ -53,7 +57,9 @@ def new_media_public_opinion_weibo(request):
o['like'] = w.like
o['transpond'] = w.transpond
o['comment'] = w.comment
o['date'] = w.date
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})
@ -72,6 +78,8 @@ def new_media_public_opinion_qita(request):
o['count_jc'] = q.count_jc
o['comment'] = q.comment
o['reply'] = q.reply
o['date'] = q.date
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