|
@@ -65,6 +65,8 @@ class DetectControllerView(View):
|
|
|
# 查询推送信息
|
|
|
elif operation == 'queryInfo':
|
|
|
return self.do_query(request_dict, response, userID)
|
|
|
+ elif operation == 'updateInterval':
|
|
|
+ return self.do_update_interval(userID, request_dict, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
else:
|
|
@@ -76,7 +78,7 @@ class DetectControllerView(View):
|
|
|
nowTime = int(time.time())
|
|
|
if not page or not line:
|
|
|
return response.json(444, 'page,line')
|
|
|
- qs = Equipment_Info.objects.filter(userID_id=userID,eventTime__gte=nowTime-3600*24*27)
|
|
|
+ qs = Equipment_Info.objects.filter(userID_id=userID, eventTime__gte=nowTime - 3600 * 24 * 27)
|
|
|
uid = request_dict.get('uid', None)
|
|
|
if uid:
|
|
|
qs = qs.filter(devUid=uid)
|
|
@@ -136,7 +138,7 @@ class DetectControllerView(View):
|
|
|
push_type = request_dict.get('push_type', None)
|
|
|
status = request_dict.get('status', None)
|
|
|
m_code = request_dict.get('m_code', None)
|
|
|
- interval = request_dict.get('interval', None)
|
|
|
+ # interval = request_dict.get('interval', None)
|
|
|
print('status:' + status)
|
|
|
if not status:
|
|
|
return response.json(444, 'status')
|
|
@@ -165,8 +167,8 @@ class DetectControllerView(View):
|
|
|
print(uid_app_qs)
|
|
|
if uid_app_qs.exists():
|
|
|
update_dict = {'status': 1}
|
|
|
- if interval:
|
|
|
- update_dict['interval'] = int(interval)
|
|
|
+ # if interval:
|
|
|
+ # update_dict['interval'] = int(interval)
|
|
|
uid_app_qs.update(**update_dict)
|
|
|
else:
|
|
|
create_dict = {
|
|
@@ -180,8 +182,8 @@ class DetectControllerView(View):
|
|
|
'm_code': m_code,
|
|
|
'addTime': now_time,
|
|
|
'updTime': now_time}
|
|
|
- if interval:
|
|
|
- create_dict['interval'] = int(interval)
|
|
|
+ # if interval:
|
|
|
+ # create_dict['interval'] = int(interval)
|
|
|
UID_App.objects.create(**create_dict)
|
|
|
except Exception as e:
|
|
|
print(repr(e))
|
|
@@ -195,6 +197,17 @@ class DetectControllerView(View):
|
|
|
else:
|
|
|
return response.json(173)
|
|
|
|
|
|
+ def do_update_interval(self, userID, request_dict, response):
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ interval = request_dict.get('interval', None)
|
|
|
+ # now_time = int(time.time())
|
|
|
+ uid_app_qs = UID_App.objects.filter(userID_id=userID, uid=uid)
|
|
|
+ if uid_app_qs.exists():
|
|
|
+ UID_App.objects.filter(uid=uid).update(interval=int(interval))
|
|
|
+ return response.json(0)
|
|
|
+ else:
|
|
|
+ return response.json(173)
|
|
|
+
|
|
|
|
|
|
# http://192.168.136.40:8077/notify/push?uidToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiJUTjdNUEUzMjExVUU3NkFQMTExQSJ9.k501567VdnhFpn_ygzGRDat3Kqlz5CsEA9jAC2dDk_g&obj=12341234&n_time=1234561234
|
|
|
# http://test.dvema.com/notify/push?uidToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJQMldOR0pSRDJFSEE1RVU5MTExQSJ9.xOCI5lerk8JOs5OcAzunrKCfCrtuPIZ3AnkMmnd-bPY&n_time=1526845794&channel=1&event_type=51&is_st=0
|
|
@@ -425,7 +438,7 @@ class NotificationView(View):
|
|
|
'alarm': 'Motion \tChannel:{channel}'.format(channel=channel),
|
|
|
'is_st': int(is_st),
|
|
|
'receiveTime': n_time,
|
|
|
- 'addTime':nowTime
|
|
|
+ 'addTime': nowTime
|
|
|
}
|
|
|
qs_list.append(Equipment_Info(**add_data))
|
|
|
if qs_list:
|