|
@@ -144,7 +144,7 @@ class NotificationView(View):
|
|
|
'Key': '9d79630aa49adfa291fe2568',
|
|
|
'Secret': '4d8ff52f88136561875a0212'},
|
|
|
'com.ansjer.customizedd_a': {
|
|
|
- 'Key': '8fc4f495685bde53341ee25dMaster',
|
|
|
+ 'Key': '8fc4f495685bde53341ee25d',
|
|
|
'Secret': 'f1da11fa466509fa2670fb66',
|
|
|
}
|
|
|
}
|
|
@@ -168,15 +168,20 @@ class NotificationView(View):
|
|
|
n_date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(n_time)))
|
|
|
if lang == 'cn':
|
|
|
if nickname:
|
|
|
- message_title = "周视({nickname})".format(nickname=nickname)
|
|
|
+ # message_title = "周视({nickname})".format(nickname=nickname)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId, nickname=nickname)
|
|
|
else:
|
|
|
- message_title = "周视({uid})".format(uid=uid)
|
|
|
+ # message_title = "周视({uid})".format(uid=uid)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId, nickname=uid)
|
|
|
send_text = '通道:{channel} 日期:{date}'.format(channel=channel, date=n_date)
|
|
|
else:
|
|
|
if nickname:
|
|
|
- message_title = "zosi({nickname})".format(nickname=nickname)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId, nickname=nickname)
|
|
|
+ # message_title = "zosi({nickname})".format(nickname=nickname)
|
|
|
else:
|
|
|
- message_title = "zosi({uid})".format(uid=uid)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId, nickname=uid)
|
|
|
+
|
|
|
+ # message_title = "zosi({uid})".format(uid=uid)
|
|
|
send_text = 'channel:{channel} date:{date}'.format(channel=channel, date=n_date)
|
|
|
android = jpush.android(alert=send_text, priority=1, style=1, alert_type=7,
|
|
|
big_text=send_text, title=message_title,
|
|
@@ -195,6 +200,26 @@ class NotificationView(View):
|
|
|
else:
|
|
|
return response.json(0)
|
|
|
|
|
|
+
|
|
|
+ def get_message_title(self, appBundleId, nickname):
|
|
|
+ package_title_config = {
|
|
|
+ 'com.ansjer.customizedd_a':'DVS',
|
|
|
+ 'com.ansjer.zccloud_a':'ZosiSmart',
|
|
|
+ 'com.ansjer.zccloud_ab':'周视',
|
|
|
+ 'com.ansjer.adcloud_a':'ADCloud',
|
|
|
+ 'com.ansjer.adcloud_ab':'ADCloud',
|
|
|
+ 'com.ansjer.accloud_a':'ACCloud',
|
|
|
+ 'com.ansjer.loocamccloud_a':'Loocam',
|
|
|
+ 'com.ansjer.loocamdcloud_a':'Anlapus',
|
|
|
+ 'com.ansjer.customizedb_a':'COCOONHD',
|
|
|
+ 'com.ansjer.customizeda_a':'Guardian365',
|
|
|
+ 'com.ansjer.customizedc_a':'PatrolSecure',
|
|
|
+ }
|
|
|
+ if appBundleId in package_title_config.keys():
|
|
|
+ return package_title_config[appBundleId]+'('+nickname+')'
|
|
|
+ else:
|
|
|
+ return nickname
|
|
|
+
|
|
|
def do_fcm(self, request_dict, uaql, response, uid, channel, nickname):
|
|
|
n_time = request_dict.get('n_time')
|
|
|
appBundleId = uaql['appBundleId']
|
|
@@ -220,15 +245,20 @@ class NotificationView(View):
|
|
|
n_date = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(int(n_time)))
|
|
|
if lang == 'cn':
|
|
|
if nickname:
|
|
|
- message_title = "周视({nickname})".format(nickname=nickname)
|
|
|
+ # message_title = "周视({nickname})".format(nickname=nickname)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId,nickname=nickname)
|
|
|
else:
|
|
|
- message_title = "周视({uid})".format(uid=uid)
|
|
|
+ # message_title = "周视({uid})".format(uid=uid)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId,nickname=uid)
|
|
|
send_text = '通道:{channel} 日期:{date}'.format(channel=channel, date=n_date)
|
|
|
else:
|
|
|
if nickname:
|
|
|
- message_title = "zosi({nickname})".format(nickname=nickname)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId,nickname=nickname)
|
|
|
+ # message_title = "zosi({nickname})".format(nickname=nickname)
|
|
|
else:
|
|
|
- message_title = "zosi({uid})".format(uid=uid)
|
|
|
+ message_title = self.get_message_title(appBundleId=appBundleId,nickname=uid)
|
|
|
+
|
|
|
+ # message_title = "zosi({uid})".format(uid=uid)
|
|
|
send_text = 'channel:{channel} date:{date}'.format(channel=channel, date=n_date)
|
|
|
data = {"alert": "Motion ", "event_time": n_time, "event_type": event_type, "msg": "",
|
|
|
"received_at": n_time, "sound": "sound.aif", "uid": uid, "zpush": "1", "channel": channel}
|