This commit is contained in:
xieshen 2020-10-22 10:46:22 +08:00
parent a61b5e43f8
commit ac24f67587
2 changed files with 19 additions and 14 deletions

View File

@ -48,21 +48,26 @@ def alarm(request):
with connection.cursor() as cursor1: with connection.cursor() as cursor1:
cursor1.execute("select * from alarms where name = '%s' order by created_at desc " % (n)) cursor1.execute("select * from alarms where name = '%s' order by created_at desc " % (n))
row1 = cursor1.fetchall() row1 = cursor1.fetchall()
alarms = [] data = []
alarms.append(n) data_all = dict()
for r1 in row1: # status = []
print(r1) # duration=[]
o = dict() # created_at=[]
o['id'] = r1[0]
o['type'] = r1[2]
o['status'] = r1[5]
o['duration'] = r1[6]
o['created_at'] = r1[7]
alarms.append(o) data_all['title'] = n
for r1 in row1:
jc_data = []
jc_data.append(r1[5])
jc_data.append(r1[6])
jc_data.append(r1[7])
data.append(jc_data)
# data.append(duration)
# data.append(created_at)
data_all['data'] = data
res.append(data_all)
print("===================================================================") print("===================================================================")
res.append(alarms) # res.append(alarms)
print(res) # print(res)
return HttpResponse(json.dumps({ return HttpResponse(json.dumps({
"status": "1", "status": "1",
"name": name, "name": name,

View File

@ -3,7 +3,7 @@
# Django-related settings # Django-related settings
socket = :8081 socket = :8003
# the base directory (full path) # the base directory (full path)
chdir = /var/www/p3/spug_expand chdir = /var/www/p3/spug_expand