|
@@ -65,6 +65,7 @@ class NotificationView(View):
|
|
|
is_st = request_dict.get('is_st', None)
|
|
|
company_secrete = request_dict.get('company_secrete', None)
|
|
|
region = request_dict.get('region', None)
|
|
|
+ electricity = request_dict.get('electricity', None)
|
|
|
|
|
|
if not all([channel, n_time]):
|
|
|
return JsonResponse(status=200, data={
|
|
@@ -167,7 +168,7 @@ class NotificationView(View):
|
|
|
msg_title = self.get_msg_title(appBundleId=appBundleId, nickname=nickname)
|
|
|
# 发送内容
|
|
|
msg_text = self.get_msg_text(channel=channel, n_time=n_time, lang=lang, tz=tz,
|
|
|
- event_type=event_type)
|
|
|
+ event_type=event_type, electricity=electricity)
|
|
|
kwag_args['appBundleId'] = appBundleId
|
|
|
kwag_args['token_val'] = token_val
|
|
|
kwag_args['msg_title'] = msg_title
|
|
@@ -189,7 +190,7 @@ class NotificationView(View):
|
|
|
now_time = int(time.time())
|
|
|
if is_sys_msg:
|
|
|
sys_msg_text = self.get_msg_text(channel=channel, n_time=n_time, lang=lang, tz=tz,
|
|
|
- event_type=event_type, is_sys=1)
|
|
|
+ event_type=event_type, electricity=electricity, is_sys=1)
|
|
|
sys_msg_list.append(SysMsgModel(
|
|
|
userID_id=userID_id,
|
|
|
msg=sys_msg_text,
|
|
@@ -318,12 +319,12 @@ class NotificationView(View):
|
|
|
return True
|
|
|
return False
|
|
|
|
|
|
- def get_msg_text(self, channel, n_time, lang, tz, event_type, is_sys=0):
|
|
|
+ def get_msg_text(self, channel, n_time, lang, tz, event_type, electricity='', is_sys=0):
|
|
|
n_date = CommonService.get_now_time_str(n_time=n_time, tz=tz,lang=lang)
|
|
|
etype = int(event_type)
|
|
|
if lang == 'cn':
|
|
|
if etype == 704:
|
|
|
- msg_type = '电量过低,剩余电量:'
|
|
|
+ msg_type = '剩余电量:' + electricity
|
|
|
elif etype == 702:
|
|
|
msg_type = '摄像头休眠'
|
|
|
elif etype == 703:
|
|
@@ -337,7 +338,7 @@ class NotificationView(View):
|
|
|
# send_text = '{msg_type} 通道:{channel} 日期:{date}'.format(msg_type=msg_type, channel=channel, date=n_date)
|
|
|
else:
|
|
|
if etype == 704:
|
|
|
- msg_type = 'Low battery'
|
|
|
+ msg_type = 'Battery remaining:' + electricity
|
|
|
elif etype == 702:
|
|
|
msg_type = 'Camera sleep'
|
|
|
elif etype == 703:
|
|
@@ -667,7 +668,7 @@ class PushNotificationView(View):
|
|
|
etype = int(event_type)
|
|
|
if lang == 'cn':
|
|
|
if etype == 704:
|
|
|
- msg_type = '电量过低,剩余电量:'
|
|
|
+ msg_type = '剩余电量:'
|
|
|
elif etype == 702:
|
|
|
msg_type = '摄像头休眠'
|
|
|
elif etype == 703:
|
|
@@ -680,7 +681,7 @@ class PushNotificationView(View):
|
|
|
send_text = '{msg_type} 通道:{channel} 日期:{date}'.format(msg_type=msg_type, channel=channel, date=n_date)
|
|
|
else:
|
|
|
if etype == 704:
|
|
|
- msg_type = 'Low battery'
|
|
|
+ msg_type = 'Battery remaining:'
|
|
|
elif etype == 702:
|
|
|
msg_type = 'Camera sleep'
|
|
|
elif etype == 703:
|
|
@@ -825,7 +826,7 @@ class PWnotificationView(View):
|
|
|
etype = int(event_type)
|
|
|
if lang == 'cn':
|
|
|
if etype == 704:
|
|
|
- msg_type = '电量已剩:'+electricity
|
|
|
+ msg_type = '剩余电量:' + electricity
|
|
|
elif etype == 702:
|
|
|
msg_type = '摄像头休眠'
|
|
|
elif etype == 703:
|
|
@@ -839,7 +840,7 @@ class PWnotificationView(View):
|
|
|
# send_text = '{msg_type} 通道:{channel} 日期:{date}'.format(msg_type=msg_type, channel=channel, date=n_date)
|
|
|
else:
|
|
|
if etype == 704:
|
|
|
- msg_type = 'Battery is left: '+electricity
|
|
|
+ msg_type = 'Battery remaining:' + electricity
|
|
|
elif etype == 702:
|
|
|
msg_type = 'Camera sleep'
|
|
|
elif etype == 703:
|