Ver Fonte

优化电量上报创建时间为服务本机时间戳

zhangdongming há 2 anos atrás
pai
commit
f5a0cc9153
1 ficheiros alterados com 1 adições e 2 exclusões
  1. 1 2
      Controller/SensorGateway/SmartSocketController.py

+ 1 - 2
Controller/SensorGateway/SmartSocketController.py

@@ -136,7 +136,6 @@ class SmartSocketView(View):
             LOGGER.info('{}上报电量统计data:{}'.format(serial_number, request_dict))
             if not all([serial_number, watt, power, accumulated_time, device_time]):
                 return response.json(444)
-            device_time = int(device_time)
             watt = float(watt)
             power = float(power)
             accumulated_time = int(accumulated_time)
@@ -160,7 +159,7 @@ class SmartSocketView(View):
                 if not socket_info_qs.exists():
                     return response.json(173)
                 data['device_id'] = socket_info_qs[0]['device_id']
-                data['created_time'] = device_time
+                data['created_time'] = now_time
                 data['serial_number'] = serial_number
                 data['electricity'] = cls.calculated_power(watt, accumulated_time)
                 data['accumulated_time'] = accumulated_time