|
@@ -96,11 +96,29 @@ class GatewayView(View):
|
|
|
if not device_info_qs.exists():
|
|
|
return response.json(173)
|
|
|
|
|
|
- local_date_time = ''
|
|
|
equipment_info_list = []
|
|
|
|
|
|
for device_info in device_info_qs:
|
|
|
user_id = device_info['userID_id']
|
|
|
+
|
|
|
+ # 组织存储数据
|
|
|
+ local_date_time = CommonService.get_now_time_str(n_time=n_time, tz=0, lang='cn')[:10]
|
|
|
+ equipment_info_list.append(EquipmentInfoService.get_equipment_info_obj(
|
|
|
+ local_date_time,
|
|
|
+ add_time=n_time,
|
|
|
+ event_time=n_time,
|
|
|
+ receive_time=n_time,
|
|
|
+ device_uid=serial_number,
|
|
|
+ device_nick_name=nickname,
|
|
|
+ alarm=alarm,
|
|
|
+ event_type=event_type,
|
|
|
+ device_user_id=user_id,
|
|
|
+ ))
|
|
|
+ if equipment_info_list:
|
|
|
+ # 根据日期获得星期几
|
|
|
+ week = LocalDateTimeUtil.date_to_week(local_date_time)
|
|
|
+ EquipmentInfoService.equipment_info_bulk_create(week, equipment_info_list)
|
|
|
+
|
|
|
# 查询推送配置数据
|
|
|
gateway_push_qs = GatewayPush.objects.filter(user_id=user_id, logout=False). \
|
|
|
values('user_id', 'app_bundle_id', 'app_type', 'push_type', 'token_val', 'm_code', 'lang', 'm_code',
|
|
@@ -116,7 +134,6 @@ class GatewayView(View):
|
|
|
|
|
|
# 推送到每台登录账号的手机
|
|
|
for gateway_push in gateway_push_qs:
|
|
|
- user_id = gateway_push['user_id']
|
|
|
app_bundle_id = gateway_push['app_bundle_id']
|
|
|
push_type = gateway_push['push_type']
|
|
|
token_val = gateway_push['token_val']
|
|
@@ -144,23 +161,6 @@ class GatewayView(View):
|
|
|
logger.info('网关推送消息异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
continue
|
|
|
|
|
|
- # 组织存储数据
|
|
|
- local_date_time = CommonService.get_now_time_str(n_time=n_time, tz=0, lang='cn')[:10]
|
|
|
- equipment_info_list.append(EquipmentInfoService.get_equipment_info_obj(
|
|
|
- local_date_time,
|
|
|
- add_time=n_time,
|
|
|
- event_time=n_time,
|
|
|
- receive_time=n_time,
|
|
|
- device_uid=serial_number,
|
|
|
- device_nick_name=nickname,
|
|
|
- alarm=alarm,
|
|
|
- event_type=event_type,
|
|
|
- device_user_id=user_id,
|
|
|
- ))
|
|
|
- if equipment_info_list:
|
|
|
- # 根据日期获得星期几
|
|
|
- week = LocalDateTimeUtil.date_to_week(local_date_time)
|
|
|
- EquipmentInfoService.equipment_info_bulk_create(week, equipment_info_list)
|
|
|
return response.json(0)
|
|
|
except Exception as e:
|
|
|
logger.info('---网关推送接口异常--- {}'.format(repr(e)))
|