Browse Source

query_reset接口如果存在序列号组织序列号数据返回

locky 3 years ago
parent
commit
879f665740
1 changed files with 8 additions and 1 deletions
  1. 8 1
      Controller/EquipmentManagerV2.py

+ 8 - 1
Controller/EquipmentManagerV2.py

@@ -9,7 +9,7 @@ from django.views.generic.base import View
 
 
 from Ansjer.config import OSS_STS_ACCESS_SECRET, OSS_STS_ACCESS_KEY
 from Ansjer.config import OSS_STS_ACCESS_SECRET, OSS_STS_ACCESS_KEY
 from Model.models import Device_Info, UID_Bucket, UID_Preview, UidSetModel, UidPushModel, UidChannelSetModel, \
 from Model.models import Device_Info, UID_Bucket, UID_Preview, UidSetModel, UidPushModel, UidChannelSetModel, \
-    iotdeviceInfoModel
+    iotdeviceInfoModel, UIDModel
 from Object.ResponseObject import ResponseObject
 from Object.ResponseObject import ResponseObject
 from Object.TokenObject import TokenObject
 from Object.TokenObject import TokenObject
 from Service.CommonService import CommonService
 from Service.CommonService import CommonService
@@ -325,6 +325,13 @@ class EquipmentManagerV2(View):
             uv_dict[us['uid']]['channels'] = channels
             uv_dict[us['uid']]['channels'] = channels
 
 
         for p in dvls:
         for p in dvls:
+            # 如果存在序列号组织序列号数据返回
+            if p['serial_number']:
+                p2p_type = str(UIDModel.objects.filter(uid=p['UID']).values('p2p_type')[0]['p2p_type'])
+                # 设备类型转为16进制并补齐4位
+                device_type = hex(p['Type'])[2:]
+                device_type = (4-len(device_type)) * '0' + device_type
+                p['UID'] = p['serial_number'] + p2p_type + device_type
             # 新增IOT
             # 新增IOT
             p['iot'] = []
             p['iot'] = []
             for iot in iotqs:
             for iot in iotqs: