#add message
This commit is contained in:
parent
0fcb9d90f3
commit
86e9c4f4b7
|
@ -165,25 +165,27 @@
|
||||||
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-7 col-xs-12">
|
<div class="col-lg-6 col-md-6 col-sm-7 col-xs-12">
|
||||||
|
|
||||||
<div class="r1_graph1 db_box">
|
{# <div class="r1_graph1 db_box">#}
|
||||||
<span class='bold'>时间/更新篇数</span>
|
{# <span class='bold'>时间/更新篇数</span>#}
|
||||||
<span class='pull-right'><small>SERVER UP</small></span>
|
{# <span class='pull-right'><small>SERVER UP</small></span>#}
|
||||||
<div class="clearfix"></div>
|
{# <div class="clearfix"></div>#}
|
||||||
<span class="db_dynamicbar">Loading...</span>
|
{# <span class="db_dynamicbar">Loading...</span>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
|
|
||||||
|
|
||||||
<div class="r1_graph2 db_box">
|
<div class="r1_graph2 db_box">
|
||||||
<span class='bold'>新媒体数量</span>
|
<span class='bold'>新媒体数量/时间</span>
|
||||||
<span class='pull-right'><small>USERS ONLINE</small></span>
|
<div id="left2" style="width: 100%;height:200px;background-color: white"></div>
|
||||||
|
|
||||||
|
{# <span class='pull-right'><small>USERS ONLINE</small></span>#}
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
<span class="db_linesparkline">Loading...</span>
|
<span class="db_linesparkline">Loading...</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="r1_graph3 db_box">
|
<div class="r1_graph3 db_box">
|
||||||
<span class='bold'>预警次数</span>
|
<span class='bold'>预警次数/时间</span>
|
||||||
<span class='pull-right'><small>ORDERS / SALES</small></span>
|
{# <span class='pull-right'><small>ORDERS / SALES</small></span>#}
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
<span class="db_compositebar">Loading...</span>
|
<span class="db_compositebar">Loading...</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -191,8 +193,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-lg-6 col-md-6 col-sm-7 col-xs-12">
|
<div class="col-lg-6 col-md-6 col-sm-7 col-xs-12" style="background-color: white">
|
||||||
<div id="main" style="width: 100%;height:350px;background-color: white"></div>
|
<span class='bold'>更新次数/时间</span>
|
||||||
|
<div id="main" style="width: 100%;height:400px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div> <!-- End .row -->
|
</div> <!-- End .row -->
|
||||||
|
@ -235,7 +238,7 @@
|
||||||
<script src="{% static 'js/jquery-jvectormap-world-mill-en.js' %}" type="text/javascript"></script>
|
<script src="{% static 'js/jquery-jvectormap-world-mill-en.js' %}" type="text/javascript"></script>
|
||||||
<script src="{% static 'js/gauge.min.js' %}" type="text/javascript"></script>
|
<script src="{% static 'js/gauge.min.js' %}" type="text/javascript"></script>
|
||||||
<script src="{% static 'js/icheck.min.js' %}" type="text/javascript"></script>
|
<script src="{% static 'js/icheck.min.js' %}" type="text/javascript"></script>
|
||||||
<script src="{% static 'js/dashboard.js' %}" type="text/javascript"></script>
|
{# <script src="{% static 'js/dashboard.js' %}" type="text/javascript"></script>#}
|
||||||
<script src="{% static 'js/echarts.min.js' %}" type="text/javascript"></script>
|
<script src="{% static 'js/echarts.min.js' %}" type="text/javascript"></script>
|
||||||
<script src="{% static 'js/chart-sparkline.js' %}" type="text/javascript"></script>
|
<script src="{% static 'js/chart-sparkline.js' %}" type="text/javascript"></script>
|
||||||
<script src="{% static 'leaflet/leaflet.js' %}" type="text/javascript"></script>
|
<script src="{% static 'leaflet/leaflet.js' %}" type="text/javascript"></script>
|
||||||
|
@ -366,5 +369,74 @@
|
||||||
// 使用刚指定的配置项和数据显示图表。
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
myChart.setOption(option);
|
myChart.setOption(option);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$.getJSON('/monitor/index/newmedia/count/', function (res) {
|
||||||
|
// 基于准备好的dom,初始化echarts实例
|
||||||
|
var myChart = echarts.init(document.getElementById('left2'));
|
||||||
|
option = {
|
||||||
|
{#title: {#}
|
||||||
|
{# text: '新媒体数量/时间',#}
|
||||||
|
{# },#}
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: ['微信', '微博', '今日头条', '抖音', '其他']
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '3%',
|
||||||
|
right: '6%',
|
||||||
|
bottom: '1%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
feature: {
|
||||||
|
saveAsImage: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
boundaryGap: false,
|
||||||
|
data: res.date_list
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value'
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '微信',
|
||||||
|
type: 'line',
|
||||||
|
stack: '总量',
|
||||||
|
data: res.weixin
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '微博',
|
||||||
|
type: 'line',
|
||||||
|
stack: '总量',
|
||||||
|
data: res.weibo
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '今日头条',
|
||||||
|
type: 'line',
|
||||||
|
stack: '总量',
|
||||||
|
data: res.toutiao
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '抖音',
|
||||||
|
type: 'line',
|
||||||
|
stack: '总量',
|
||||||
|
data: res.douyin
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '其他',
|
||||||
|
type: 'line',
|
||||||
|
stack: '总量',
|
||||||
|
data: res.qita
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
// 使用刚指定的配置项和数据显示图表。
|
||||||
|
myChart.setOption(option);
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -33,6 +33,7 @@ urlpatterns = [
|
||||||
path('monitoring/report/json/',views.monitoring_report_json,name='monitor-monitoring-report-json'),
|
path('monitoring/report/json/',views.monitoring_report_json,name='monitor-monitoring-report-json'),
|
||||||
#首页图
|
#首页图
|
||||||
path('index/map/',views.index_map,name='index-map'),
|
path('index/map/',views.index_map,name='index-map'),
|
||||||
|
path('index/newmedia/count/',views.index_newmedia_count,name='index-newmedia-count'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ from datetime import timedelta
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
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, \
|
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita, \
|
||||||
Douyin, Douyin_data, News, TimelinessMonitoring, Organization, Wrongly
|
Douyin, Douyin_data, News, TimelinessMonitoring, Organization, Wrongly, NewMedia
|
||||||
from monitor.models import Test
|
from monitor.models import Test
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -1123,3 +1123,50 @@ def index_map(request):
|
||||||
"timelinessmonitoring_douyin":timelinessmonitoring_douyin,
|
"timelinessmonitoring_douyin":timelinessmonitoring_douyin,
|
||||||
"timelinessmonitoring_qita":timelinessmonitoring_qita,
|
"timelinessmonitoring_qita":timelinessmonitoring_qita,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
def index_newmedia_count(request):
|
||||||
|
date_list = [x.strftime('%Y-%m-%d') for x in list(pd.date_range(start='2020-08-22',end=datetime.datetime.now()))]
|
||||||
|
# weixin_date = Weixin.objects.all().order_by('-created')
|
||||||
|
# weibo_date = Weibo.objects.all().order_by('-created')
|
||||||
|
# toutiao_date = Toutiao.objects.all().order_by('-created')
|
||||||
|
# douyin_date = Douyin.objects.all().order_by('-created')
|
||||||
|
# qita_date = Qita.objects.all().order_by('-created')
|
||||||
|
# for w_d in weixin_date:
|
||||||
|
# date_list.append(str(w_d.created).split(' ')[0])
|
||||||
|
# for w_t in weibo_date:
|
||||||
|
# date_list.append(str(w_t.created).split(' ')[0])
|
||||||
|
# for t_d in toutiao_date:
|
||||||
|
# date_list.append(str(t_d.created).split(' ')[0])
|
||||||
|
# for d_d in douyin_date:
|
||||||
|
# date_list.append(str(d_d.created).split(' ')[0])
|
||||||
|
# for q_d in qita_date:
|
||||||
|
# date_list.append(str(q_d.created).split(' ')[0])
|
||||||
|
|
||||||
|
weixin_list = []
|
||||||
|
weibo_list = []
|
||||||
|
toutiao_list = []
|
||||||
|
douyin_list = []
|
||||||
|
qita_list = []
|
||||||
|
for d in date_list:
|
||||||
|
print(d)
|
||||||
|
s = str(d).split('-')
|
||||||
|
print(s[0],s[1],s[2])
|
||||||
|
weixin = Weixin.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
|
||||||
|
weixin_list.append(weixin)
|
||||||
|
weibo = Weibo.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
|
||||||
|
weibo_list.append(weibo)
|
||||||
|
toutiao = Toutiao.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
|
||||||
|
toutiao_list.append(toutiao)
|
||||||
|
douyin = Douyin.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
|
||||||
|
douyin_list.append(douyin)
|
||||||
|
qita = Qita.objects.filter(created__year=s[0],created__month=s[1],created__day=s[2]).count()
|
||||||
|
qita_list.append(qita)
|
||||||
|
return HttpResponse(json.dumps({
|
||||||
|
"status":"1",
|
||||||
|
"date_list":list(set(date_list)),
|
||||||
|
"weixin":weixin_list,
|
||||||
|
"weibo":weibo_list,
|
||||||
|
"toutiao":toutiao_list,
|
||||||
|
"douyin":douyin_list,
|
||||||
|
"qita":qita_list,
|
||||||
|
}))
|
||||||
|
|
Loading…
Reference in New Issue