|
@@ -51,6 +51,8 @@ class WXTechControllerView(View):
|
|
|
return self.validation(put, request, operation)
|
|
|
|
|
|
def validation(self, request_dict, request, operation):
|
|
|
+ if operation == 'unbindIccidBySerialNo':
|
|
|
+ return self.unbind_iccid_by_serial_no(request, ResponseObject('cn'))
|
|
|
if operation == 'deleteCardPackage':
|
|
|
return self.delete_card_package(request_dict, ResponseObject('cn'))
|
|
|
elif operation == 'packageRefund':
|
|
@@ -568,3 +570,15 @@ class WXTechControllerView(View):
|
|
|
.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
cls.save_log(ip, 500, f'{serial_number}领取流量套餐异常')
|
|
|
return False
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def unbind_iccid_by_serial_no(cls, request, response):
|
|
|
+ file = request.FILES['serialFile']
|
|
|
+ for line in file:
|
|
|
+ serial_number = line.decode().strip()[0:9]
|
|
|
+ info_qs = UnicomDeviceInfo.objects.filter(serial_no=serial_number)
|
|
|
+ if info_qs.exists() and info_qs.count() > 1:
|
|
|
+ continue
|
|
|
+ elif info_qs.exists() and info_qs.count() == 1:
|
|
|
+ print(f'{serial_number}绑定一个')
|
|
|
+ return response.json(0)
|