|
@@ -55,7 +55,7 @@ class IotCoreView(View):
|
|
|
return response.json(404)
|
|
|
|
|
|
region_country_qs = Device_Info.objects.filter(UID=uid).values('userID__region_country')
|
|
|
- if not region_country_qs.exists():
|
|
|
+ if not region_country_qs.exists() or region_country_qs[0]['userID__region_country'] == 0 :
|
|
|
return response.json(173)
|
|
|
|
|
|
region_country_qs = RegionCountryModel.objects.filter(number=region_country_qs[0]['userID__region_country'])
|
|
@@ -94,19 +94,17 @@ class IotCoreView(View):
|
|
|
distance = now_time - time_stamp
|
|
|
|
|
|
# if token != time_stamp and distance > 600: 暂时去掉延时
|
|
|
- # if token != time_stamp or uid != uid_code or distance > 600 :
|
|
|
- # return response.json(404)
|
|
|
+ if token != time_stamp or uid != uid_code or distance > 600 :
|
|
|
+ return response.json(404)
|
|
|
|
|
|
region_country_qs = Device_Info.objects.filter(UID=uid).values('userID__region_country')
|
|
|
- if not region_country_qs.exists():
|
|
|
+ if not region_country_qs.exists() or region_country_qs[0]['userID__region_country'] == 0 :
|
|
|
return response.json(173)
|
|
|
|
|
|
- uid_list = []
|
|
|
- for i in iotdeviceInfoModel.objects.values('uid'):
|
|
|
- # 把数据表里的uid加到uid_list
|
|
|
- uid_list.append(i['uid'])
|
|
|
+ iotqs = iotdeviceInfoModel.objects.filter(uid=uid)
|
|
|
+
|
|
|
# 判断设备是否已注册证书
|
|
|
- if uid not in uid_list:
|
|
|
+ if not iotqs.exists():
|
|
|
region_country_qs = RegionCountryModel.objects.filter(
|
|
|
number=region_country_qs[0]['userID__region_country'])
|
|
|
if region_country_qs.exists():
|