|
@@ -83,7 +83,7 @@ class DetectControllerView(View):
|
|
else:
|
|
else:
|
|
utko = UidTokenObject()
|
|
utko = UidTokenObject()
|
|
utko.generate(data={'uid': uid})
|
|
utko.generate(data={'uid': uid})
|
|
- detectUrl = "{SERVER_DOMAIN}cloudVod/getSts?uidToken={uidToken}". \
|
|
|
|
|
|
+ detectUrl = "{SERVER_DOMAIN}detect/push?uidToken={uidToken}". \
|
|
format(uidToken=utko.token, SERVER_DOMAIN=SERVER_DOMAIN)
|
|
format(uidToken=utko.token, SERVER_DOMAIN=SERVER_DOMAIN)
|
|
return response.json(0, {'detectUrl': detectUrl})
|
|
return response.json(0, {'detectUrl': detectUrl})
|
|
else:
|
|
else:
|
|
@@ -97,7 +97,6 @@ class NotificationView(View):
|
|
# operation = kwargs.get('operation')
|
|
# operation = kwargs.get('operation')
|
|
return self.validation(request.GET)
|
|
return self.validation(request.GET)
|
|
|
|
|
|
-
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
def post(self, request, *args, **kwargs):
|
|
request.encoding = 'utf-8'
|
|
request.encoding = 'utf-8'
|
|
# operation = kwargs.get('operation')
|
|
# operation = kwargs.get('operation')
|
|
@@ -111,7 +110,7 @@ class NotificationView(View):
|
|
utko = UidTokenObject(uidToken)
|
|
utko = UidTokenObject(uidToken)
|
|
uid = utko.UID
|
|
uid = utko.UID
|
|
uaqs = UID_App.objects.filter(uid=uid). \
|
|
uaqs = UID_App.objects.filter(uid=uid). \
|
|
- values('token_val', 'app_type', 'appBundleId', 'push_type', 'uid','userID_id')
|
|
|
|
|
|
+ values('token_val', 'app_type', 'appBundleId', 'push_type', 'uid', 'userID_id')
|
|
if uaqs.exists():
|
|
if uaqs.exists():
|
|
for ua in uaqs:
|
|
for ua in uaqs:
|
|
push_type = ua['push_type']
|
|
push_type = ua['push_type']
|
|
@@ -199,7 +198,11 @@ class NotificationView(View):
|
|
token_val = uaql['token_val']
|
|
token_val = uaql['token_val']
|
|
uid = uaql['uid']
|
|
uid = uaql['uid']
|
|
gcm_config = {
|
|
gcm_config = {
|
|
- 'xxx': 'key'
|
|
|
|
|
|
+ 'com.ansjer.zccloud_a': 'AAAAb9YP3rk:APA91bHu8u-CTpcd0g6lKPo0WNVqCi8jZub1cPPbSAY9AucT1HxlF65ZDUko9iG8q2ch17bwu9YWHpK1xI1gHSRXCslLvZlXEmHZC0AG3JKg15XuUvlFKACIajUFV-pOeGRT8tM6-31I',
|
|
|
|
+ 'com.ansjer.loocamccloud_a': 'AAAAb9YP3rk:APA91bFCgd-kbVmpK4EVpfdHH_PJZQCYTkOGnTZdIuBWEz2r7aMRsJYHOH3sB-rwcbaRWgnufTyjX9nGQxb6KxQbWVk4ah_H-M3IqGh6Mb60WQQAuR33V6g_Jes5pGL6ViuIxGHqVMaR',
|
|
|
|
+ 'com.ansjer.loocamdcloud_a': 'AAAAb9YP3rk:APA91bGw2I2KMD4i-5T7nZO_wB8kuAOuqgyqe5rxmY-W5qkpYEx9IL2IfmC_qf6B_xOyjIDDSjckvMo-RauN__SEoxvAkis7042GRkoKpw7cjZ_H8lC-d50PC0GclPzccrOGFusyKbFY',
|
|
|
|
+ 'com.ansjer.customizedb_a': 'AAAAb9YP3rk:APA91bE7kI4vcm-9h_CJNFlOZfc-xwP4Btn6AnjOrwoKV6fgYN7fdarkO76sYxVZiAbDnxsFfOJyP7vQfwyan6mdjuyD5iHdt_XgO22VqniC0vA1V4GJiCS8Tp7LxIX8JVKZl9I_Powt',
|
|
|
|
+ 'com.ansjer.customizeda_a': 'AAAAb9YP3rk:APA91bF0HzizVWDc6dKzobY9fsaKDK4veqkOZehDXshVXs8pEEvNWjR_YWbhP60wsRYCHCal8fWN5cECVOWNMMzDsfU88Ty2AUl8S5FtZsmeDTkoGntQOswBr8Ln7Fm_LAp1VqTf9CpM',
|
|
}
|
|
}
|
|
serverKey = gcm_config[appBundleId]
|
|
serverKey = gcm_config[appBundleId]
|
|
|
|
|
|
@@ -242,14 +245,14 @@ class NotificationView(View):
|
|
# assert res.status_code == 200, res.reason
|
|
# assert res.status_code == 200, res.reason
|
|
# assert res.apns_id
|
|
# assert res.apns_id
|
|
if res.status_code == 200:
|
|
if res.status_code == 200:
|
|
- self.do_save_equipment_info(uaql,n_time)
|
|
|
|
|
|
+ self.do_save_equipment_info(uaql, n_time)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
else:
|
|
else:
|
|
return response.json(404, res.reason)
|
|
return response.json(404, res.reason)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
return response.json(10, repr(e))
|
|
return response.json(10, repr(e))
|
|
|
|
|
|
- def do_save_equipment_info(self,uaql,n_time):
|
|
|
|
|
|
+ def do_save_equipment_info(self, uaql, n_time):
|
|
Equipment_Info.objects.create(
|
|
Equipment_Info.objects.create(
|
|
userID_id=uaql['userID_id'],
|
|
userID_id=uaql['userID_id'],
|
|
eventTime=n_time,
|
|
eventTime=n_time,
|
|
@@ -259,4 +262,4 @@ class NotificationView(View):
|
|
Channel='0',
|
|
Channel='0',
|
|
alarm='xxx',
|
|
alarm='xxx',
|
|
receiveTime=n_time)
|
|
receiveTime=n_time)
|
|
- return
|
|
|
|
|
|
+ return True
|