|
@@ -132,8 +132,19 @@ class SerialNumberView(View):
|
|
company_secret = 'ZsKWcxdD'
|
|
company_secret = 'ZsKWcxdD'
|
|
|
|
|
|
try:
|
|
try:
|
|
- # 判断序列号是否刚解绑,刚解绑1分钟内不能进行绑定
|
|
|
|
redisObj = RedisObject()
|
|
redisObj = RedisObject()
|
|
|
|
+ # 查询app是否已扫码,未扫码不能进行绑定
|
|
|
|
+ # 如果没扫码设置24小时的缓存,扫码后删除缓存
|
|
|
|
+ scanned_serial_key = serial + 'scanned_serial'
|
|
|
|
+ if redisObj.get_data(scanned_serial_key):
|
|
|
|
+ return response.json(5)
|
|
|
|
+ app_scanned_serial_qs = AppScannedSerial.objects.filter(serial=serial).values('region_country')
|
|
|
|
+ if not app_scanned_serial_qs.exists():
|
|
|
|
+ redisObj.set_data(scanned_serial_key, 1, 24*60*60)
|
|
|
|
+ LOGGER.info(f'{serial}当前序列号未进行APP扫码')
|
|
|
|
+ return response.json(5)
|
|
|
|
+
|
|
|
|
+ # 判断序列号是否刚解绑,刚解绑1分钟内不能进行绑定
|
|
unused_serial_redis_list = redisObj.lrange(UNUSED_SERIAL_REDIS_LIST, 0, -1)
|
|
unused_serial_redis_list = redisObj.lrange(UNUSED_SERIAL_REDIS_LIST, 0, -1)
|
|
unused_serial_redis_list = [str(i, 'utf-8') for i in unused_serial_redis_list]
|
|
unused_serial_redis_list = [str(i, 'utf-8') for i in unused_serial_redis_list]
|
|
if serial in unused_serial_redis_list:
|
|
if serial in unused_serial_redis_list:
|
|
@@ -164,11 +175,6 @@ class SerialNumberView(View):
|
|
if is_verify == '1':
|
|
if is_verify == '1':
|
|
region_country = 0
|
|
region_country = 0
|
|
else:
|
|
else:
|
|
- # 查询app是否已扫码,未扫码不能进行绑定
|
|
|
|
- app_scanned_serial_qs = AppScannedSerial.objects.filter(serial=serial).values('region_country')
|
|
|
|
- if not app_scanned_serial_qs.exists():
|
|
|
|
- LOGGER.info(f'{serial}当前序列号未进行APP扫码')
|
|
|
|
- return response.json(5)
|
|
|
|
region_country = app_scanned_serial_qs[0]['region_country']
|
|
region_country = app_scanned_serial_qs[0]['region_country']
|
|
|
|
|
|
# 获取并判断region_id
|
|
# 获取并判断region_id
|
|
@@ -661,6 +667,11 @@ class SerialNumberView(View):
|
|
data['add_time'] = now_time
|
|
data['add_time'] = now_time
|
|
AppScannedSerial.objects.create(**data)
|
|
AppScannedSerial.objects.create(**data)
|
|
|
|
|
|
|
|
+ # 扫码后删除缓存
|
|
|
|
+ redis_obj = RedisObject()
|
|
|
|
+ scanned_serial_key = serial + 'scanned_serial'
|
|
|
|
+ redis_obj.del_data(scanned_serial_key)
|
|
|
|
+
|
|
if company_serial.status == 0 or company_serial.status == 1: # 未使用
|
|
if company_serial.status == 0 or company_serial.status == 1: # 未使用
|
|
UnicomComboView().is_4g_device(serial_number, request_dict, request)
|
|
UnicomComboView().is_4g_device(serial_number, request_dict, request)
|
|
return response.json(173)
|
|
return response.json(173)
|