diff --git a/.gitignore b/.gitignore index 224dbd3..b32a787 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ -.idea/ -.venv/ -.media/ -*/__pycache__/ -*/*.pyc -*/migrations -NewMediaMonitoring/local_settings.py \ No newline at end of file +.idea/ +.venv/ +.media/ +*/__pycache__/ +*/*.pyc +*/migrations +NewMediaMonitoring/local_settings.py diff --git a/dashboard/models.py b/dashboard/models.py index 4b3fd56..99f2870 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -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( diff --git a/dashboard/views.py b/dashboard/views.py index c6dfedc..65c0cfe 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -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): diff --git a/graph/static/graph/js/data-count.js b/graph/static/graph/js/data-count.js index b5c856e..5d0a6e9 100644 --- a/graph/static/graph/js/data-count.js +++ b/graph/static/graph/js/data-count.js @@ -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) } diff --git a/graph/views.py b/graph/views.py index a579dd9..2001db3 100644 --- a/graph/views.py +++ b/graph/views.py @@ -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)) + diff --git a/monitor/views.py b/monitor/views.py index 77a8ba6..3026024 100644 --- a/monitor/views.py +++ b/monitor/views.py @@ -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}) diff --git a/static/media/groupimage/20181201110659913_JHdpdEw.PNG b/static/media/groupimage/20181201110659913_JHdpdEw.PNG new file mode 100644 index 0000000..7c28870 Binary files /dev/null and b/static/media/groupimage/20181201110659913_JHdpdEw.PNG differ diff --git a/static/media/groupimage/20181201110659913_OirtNXq.PNG b/static/media/groupimage/20181201110659913_OirtNXq.PNG new file mode 100644 index 0000000..7c28870 Binary files /dev/null and b/static/media/groupimage/20181201110659913_OirtNXq.PNG differ diff --git a/static/media/groupimage/20181201110659913_PoEjDYE.PNG b/static/media/groupimage/20181201110659913_PoEjDYE.PNG new file mode 100644 index 0000000..7c28870 Binary files /dev/null and b/static/media/groupimage/20181201110659913_PoEjDYE.PNG differ diff --git a/static/media/groupimage/20181201110659913_ZLTCblG.PNG b/static/media/groupimage/20181201110659913_ZLTCblG.PNG new file mode 100644 index 0000000..7c28870 Binary files /dev/null and b/static/media/groupimage/20181201110659913_ZLTCblG.PNG differ diff --git a/static/media/groupimage/20181201110659913_uH4FATS.PNG b/static/media/groupimage/20181201110659913_uH4FATS.PNG new file mode 100644 index 0000000..7c28870 Binary files /dev/null and b/static/media/groupimage/20181201110659913_uH4FATS.PNG differ diff --git a/static/media/profile/微信图片_20200724112643_SgZWgUs.jpg b/static/media/profile/微信图片_20200724112643_SgZWgUs.jpg new file mode 100644 index 0000000..00f7364 Binary files /dev/null and b/static/media/profile/微信图片_20200724112643_SgZWgUs.jpg differ