#add message
This commit is contained in:
parent
9cc861d92f
commit
a7c90cadb4
|
@ -1,16 +1,16 @@
|
|||
{"type":"GeometryCollection", "geometries": [
|
||||
{"type":"Point","coordinates":[103.21138968234294,35.607512692578624]},
|
||||
{"type":"Point","coordinates":[106.68598194698906,35.53606492868464]},
|
||||
{"type":"Point","coordinates":[107.63846071874666,35.736769736267604]},
|
||||
{"type":"Point","coordinates":[105.71725010225042,34.58566637377387]},
|
||||
{"type":"Point","coordinates":[98.27299584495046,39.80280050328038]},
|
||||
{"type":"Point","coordinates":[98.51133730612352,39.74528877888346]},
|
||||
{"type":"Point","coordinates":[100.45006377860376,38.93343584015164]},
|
||||
{"type":"Point","coordinates":[102.16563592029843,38.492145353375044]},
|
||||
{"type":"Point","coordinates":[102.6349087754885,37.927210175300395]},
|
||||
{"type":"Point","coordinates":[104.1744411716665,36.54651652242124]},
|
||||
{"type":"Point","coordinates":[102.90200891086752,34.98901123240807]},
|
||||
{"type":"Point","coordinates":[104.62057128762616,35.57531599755989]},
|
||||
{"type":"Point","coordinates":[105.7306076212791,33.74373621886378]},
|
||||
{"type":"Point","coordinates":[103.84737984424271,36.04726953744183]}
|
||||
{"type":"Point","coordinates":[103.21138968234294,35.607512692578624],"name":"临夏市"},
|
||||
{"type":"Point","coordinates":[106.68598194698906,35.53606492868464],"name": "平凉市"},
|
||||
{"type":"Point","coordinates":[107.63846071874666,35.736769736267604],"name": "西峰市"},
|
||||
{"type":"Point","coordinates":[105.71725010225042,34.58566637377387],"name": "天水市"},
|
||||
{"type":"Point","coordinates":[98.27299584495046,39.80280050328038],"name": "嘉峪关"},
|
||||
{"type":"Point","coordinates":[98.51133730612352,39.74528877888346],"name": "酒泉市"},
|
||||
{"type":"Point","coordinates":[100.45006377860376,38.93343584015164],"name": "张掖市"},
|
||||
{"type":"Point","coordinates":[102.16563592029843,38.492145353375044],"name": "金昌市"},
|
||||
{"type":"Point","coordinates":[102.6349087754885,37.927210175300395],"name": "武威市"},
|
||||
{"type":"Point","coordinates":[104.1744411716665,36.54651652242124],"name": "白银市"},
|
||||
{"type":"Point","coordinates":[102.90200891086752,34.98901123240807],"name": "合作市"},
|
||||
{"type":"Point","coordinates":[104.62057128762616,35.57531599755989],"name": "定西市"},
|
||||
{"type":"Point","coordinates":[105.7306076212791,33.74373621886378],"name": "成县"},
|
||||
{"type":"Point","coordinates":[103.84737984424271,36.04726953744183],"name": "兰州市"}
|
||||
]}
|
|
@ -19,28 +19,52 @@ $(function () {
|
|||
format: 'image/png'
|
||||
});
|
||||
map.addLayer(gansuLayer);
|
||||
var citypointLayer = L.nonTiledLayer.wms('http://210.77.68.250:8080/geoserver/newmedia/wms', {
|
||||
layers: 'newmedia:citypoint',
|
||||
transparent: true,
|
||||
format: 'image/png'
|
||||
// var citypointLayer = L.nonTiledLayer.wms('http://210.77.68.250:8080/geoserver/newmedia/wms', {
|
||||
// layers: 'newmedia:citypoint',
|
||||
// transparent: true,
|
||||
// format: 'image/png'
|
||||
// });
|
||||
// map.addLayer(citypointLayer);
|
||||
|
||||
|
||||
$.ajax("/static/monitor/js/citypoint.json", {
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
var marker;
|
||||
console.log(response.geometries);
|
||||
for (var i = 0; i < response.geometries.length; i++) {
|
||||
marker = L.marker([response.geometries[i].coordinates[1], response.geometries[i].coordinates[0]], response.geometries[i].name).addTo(map);
|
||||
marker_click(marker,response.geometries[i].name);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
map.addLayer(citypointLayer);
|
||||
// .bindPopup(response.geometries[i].name).openPopup()
|
||||
|
||||
// var mypop = L.popup();
|
||||
});
|
||||
function marker_click(marker,name){
|
||||
|
||||
// var content = '你临幸了这个点:<br>';
|
||||
// content += e.latlng.toString();
|
||||
// mypop.setLatLng(e.latlng)
|
||||
// .setContent(content)
|
||||
// .openOn(map);
|
||||
|
||||
map.on('click', function (e) {
|
||||
$.ajax("/static/monitor/js/citypoint.json", {
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
marker.on('click', function (e) {
|
||||
console.log(name);
|
||||
$.ajax({
|
||||
url: '/monitor/index/map/?name='+name,
|
||||
type: 'get',
|
||||
dataType:'json',
|
||||
contentType: false,
|
||||
success: function (res){
|
||||
console.log(res);
|
||||
var content = '微信:'+res.timelinessmonitoring_weixin+'<br>'+'微博:'+res.timelinessmonitoring_weibo+'<br>'+'头条:'+res.timelinessmonitoring_toutiao+'<br>'+'抖音:'+res.timelinessmonitoring_douyin+'<br>'+'其他:'+res.timelinessmonitoring_qita+'<br>';
|
||||
marker.bindPopup(content).openPopup();
|
||||
}
|
||||
});
|
||||
});
|
||||
// console.log(e.feature);
|
||||
// var mypop = L.popup();
|
||||
//
|
||||
// var content = '你临幸了这个点:<br>';
|
||||
// content += e.latlng.toString();
|
||||
// mypop.setLatLng(e.latlng)
|
||||
// .setContent(content)
|
||||
// .openOn(map);
|
||||
// });
|
||||
});
|
||||
|
||||
}
|
|
@ -27,7 +27,7 @@ urlpatterns = [
|
|||
path('monitoring/report/',views.monitoring_report,name='monitor-monitoring-report'),
|
||||
path('monitoring/report/json/',views.monitoring_report_json,name='monitor-monitoring-report-json'),
|
||||
#首页图
|
||||
|
||||
path('index/map/',views.index_map,name='index-map'),
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@ from django.http import HttpResponse, JsonResponse
|
|||
from django.shortcuts import render
|
||||
from datetime import timedelta
|
||||
# Create your views here.
|
||||
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
|
||||
from monitor.models import Test
|
||||
|
@ -826,3 +828,25 @@ def timeliness_monitoring_json(request):
|
|||
"linxia":linxia,
|
||||
"date":date_list,
|
||||
}))
|
||||
def index_map(request):
|
||||
name = request.GET.get('name')
|
||||
print(name)
|
||||
timelinessmonitoring_weixin = \
|
||||
TimelinessMonitoring.objects.filter(city__contains=name, n_type='微信').aggregate(nums=Sum('update'))['nums']
|
||||
timelinessmonitoring_weibo = \
|
||||
TimelinessMonitoring.objects.filter(city__contains=name, n_type='微博').aggregate(nums=Sum('update'))['nums']
|
||||
timelinessmonitoring_toutiao = \
|
||||
TimelinessMonitoring.objects.filter(city__contains=name, n_type='今日头条').aggregate(nums=Sum('update'))['nums']
|
||||
timelinessmonitoring_douyin = \
|
||||
TimelinessMonitoring.objects.filter(city__contains=name, n_type='抖音').aggregate(nums=Sum('update'))['nums']
|
||||
timelinessmonitoring_qita = \
|
||||
TimelinessMonitoring.objects.filter(city__contains=name).exclude(n_type__in=['微信', '微博', '今日头条', '抖音']).aggregate(
|
||||
nums=Sum('update'))['nums']
|
||||
return HttpResponse(json.dumps({
|
||||
"status":"1",
|
||||
"timelinessmonitoring_weixin":timelinessmonitoring_weixin,
|
||||
"timelinessmonitoring_weibo":timelinessmonitoring_weibo,
|
||||
"timelinessmonitoring_toutiao":timelinessmonitoring_toutiao,
|
||||
"timelinessmonitoring_douyin":timelinessmonitoring_douyin,
|
||||
"timelinessmonitoring_qita":timelinessmonitoring_qita,
|
||||
}))
|
Loading…
Reference in New Issue