|
@@ -9,6 +9,7 @@ import hashlib
|
|
|
import json
|
|
|
import threading
|
|
|
import time
|
|
|
+import random
|
|
|
import uuid
|
|
|
from decimal import Decimal
|
|
|
|
|
@@ -31,6 +32,7 @@ from Object.TokenObject import TokenObject
|
|
|
from Object.UnicomObject import UnicomObjeect
|
|
|
from Object.WXTechObject import WXTechObject
|
|
|
from Service.CommonService import CommonService
|
|
|
+from Object.EIoTClubObject import EIoTClubObject
|
|
|
|
|
|
|
|
|
class UnicomManageControllerView(View):
|
|
@@ -153,6 +155,8 @@ class UnicomManageControllerView(View):
|
|
|
device_info_qs = UnicomDeviceInfo.objects.filter(serial_no=serial_number)
|
|
|
now_time = int(time.time())
|
|
|
if device_info_qs.exists(): # 首先查询SIM卡绑定信息是否存在
|
|
|
+ if device_info_qs.count() > 1:
|
|
|
+ return response.json(177)
|
|
|
iccid = device_info_qs.first().iccid
|
|
|
# 根据序列号重置出厂流量套餐
|
|
|
serial_package_qs = SerialNumberPackage.objects.filter(~Q(status=1), serial_number=serial_number)
|
|
@@ -822,6 +826,10 @@ class UnicomManageControllerView(View):
|
|
|
if card_type == 1:
|
|
|
data = {'iccid': iccid, 'operator': 3}
|
|
|
return response.json(0, {'package_list': cls.get_wx_package_list(**data)})
|
|
|
+ if card_type == 5:
|
|
|
+ data = {'iccid': iccid, 'timestamp': int(time.time()), 'nonce': random.randint(10000, 99999) }
|
|
|
+ original_data = EIoTClubObject.query_order_record_list("v3",**data)
|
|
|
+ return response.json(0, {'package_list': cls.get_dx_package_list(original_data)})
|
|
|
return response.json(0, {'package_list': package_list})
|
|
|
|
|
|
@staticmethod
|
|
@@ -1083,9 +1091,11 @@ class UnicomManageControllerView(View):
|
|
|
device_info_qs = UnicomDeviceInfo.objects.filter(serial_no=serial_number)
|
|
|
now_time = int(time.time())
|
|
|
if not device_info_qs.exists():
|
|
|
- err_data.append({'serialNumber': serial_number, 'msg': '数据不存在'})
|
|
|
+ err_data.append({'serialNumber': serial_number, 'msg': 'data is null'})
|
|
|
+ continue
|
|
|
+ if device_info_qs.count() > 1:
|
|
|
+ err_data.append({'serialNumber': serial_number, 'msg': 'Bind multiple iccid'})
|
|
|
continue
|
|
|
-
|
|
|
iccid = device_info_qs.first().iccid
|
|
|
if binding_type == 1:
|
|
|
SerialNumberPackage.objects.filter(serial_number=serial_number).delete()
|
|
@@ -1133,6 +1143,10 @@ class UnicomManageControllerView(View):
|
|
|
except Exception as e:
|
|
|
err_data.append({'serialNumber': serial_number, 'msg': '重置流量异常:{}'.format(repr(e))})
|
|
|
continue
|
|
|
+ if err_data:
|
|
|
+ describe = json.loads(json.dumps(err_data))
|
|
|
+ UnicomManageControllerView().create_operation_log('unicom/manage/iccidBatchReset', ip, binding_type,
|
|
|
+ describe)
|
|
|
LOGGER.info(f'批量重置流量type={binding_type},err_data={err_data}')
|
|
|
|
|
|
@classmethod
|