|
@@ -11,6 +11,8 @@ import time
|
|
|
from django.views.generic.base import View
|
|
|
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
+from Object.utils import LocalDateTimeUtil
|
|
|
+from Service.CommonService import CommonService
|
|
|
from Service.EquipmentInfoService import EquipmentInfoService
|
|
|
|
|
|
|
|
@@ -46,8 +48,10 @@ class GatewayView(View):
|
|
|
device_user_id = '160879593527813800138000'
|
|
|
try:
|
|
|
event_type = int(event_type)
|
|
|
+ local_date_time = CommonService.get_now_time_str(n_time=now_time, tz=0, lang='cn')
|
|
|
+ local_date_time = local_date_time[:10]
|
|
|
equipment_info_list.append(EquipmentInfoService.get_equipment_info_obj(
|
|
|
- now_time,
|
|
|
+ local_date_time,
|
|
|
add_time=now_time,
|
|
|
event_time=now_time,
|
|
|
receive_time=now_time,
|
|
@@ -57,6 +61,10 @@ class GatewayView(View):
|
|
|
device_nick_name=src_addr,
|
|
|
device_user_id=device_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:
|
|
|
return response.json(500, repr(e))
|