#alarm
This commit is contained in:
parent
a61b5e43f8
commit
ac24f67587
|
@ -48,21 +48,26 @@ def alarm(request):
|
|||
with connection.cursor() as cursor1:
|
||||
cursor1.execute("select * from alarms where name = '%s' order by created_at desc " % (n))
|
||||
row1 = cursor1.fetchall()
|
||||
alarms = []
|
||||
alarms.append(n)
|
||||
for r1 in row1:
|
||||
print(r1)
|
||||
o = dict()
|
||||
o['id'] = r1[0]
|
||||
o['type'] = r1[2]
|
||||
o['status'] = r1[5]
|
||||
o['duration'] = r1[6]
|
||||
o['created_at'] = r1[7]
|
||||
data = []
|
||||
data_all = dict()
|
||||
# status = []
|
||||
# duration=[]
|
||||
# created_at=[]
|
||||
|
||||
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("===================================================================")
|
||||
res.append(alarms)
|
||||
print(res)
|
||||
# res.append(alarms)
|
||||
# print(res)
|
||||
return HttpResponse(json.dumps({
|
||||
"status": "1",
|
||||
"name": name,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# Django-related settings
|
||||
|
||||
socket = :8081
|
||||
socket = :8003
|
||||
|
||||
# the base directory (full path)
|
||||
chdir = /var/www/p3/spug_expand
|
||||
|
|
Loading…
Reference in New Issue