|
@@ -383,13 +383,14 @@ class UnicomComboView(View):
|
|
return response.json(0)
|
|
return response.json(0)
|
|
params = {'iccid': iccid, 'serial_no': serial_no, 'updated_time': n_time,
|
|
params = {'iccid': iccid, 'serial_no': serial_no, 'updated_time': n_time,
|
|
'created_time': n_time, 'main_card': sim}
|
|
'created_time': n_time, 'main_card': sim}
|
|
- if sim == 0:
|
|
|
|
|
|
+ if sim == 0: # 1:贴片卡,0:拔插卡
|
|
if cls.is_dingxin_iot(iccid): # 鼎芯物联卡
|
|
if cls.is_dingxin_iot(iccid): # 鼎芯物联卡
|
|
params['card_type'] = 5
|
|
params['card_type'] = 5
|
|
params['status'] = 2
|
|
params['status'] = 2
|
|
UnicomDeviceInfo.objects.create(**params)
|
|
UnicomDeviceInfo.objects.create(**params)
|
|
cls.create_operation_log('unicom/api/device-bind',
|
|
cls.create_operation_log('unicom/api/device-bind',
|
|
ip, request_dict, '4G序列号{}新绑定鼎芯{}'.format(serial_no, iccid))
|
|
ip, request_dict, '4G序列号{}新绑定鼎芯{}'.format(serial_no, iccid))
|
|
|
|
+ return response.json(0)
|
|
return response.json(0, '外置卡不保存相关信息{}'.format(serial_no))
|
|
return response.json(0, '外置卡不保存相关信息{}'.format(serial_no))
|
|
|
|
|
|
if cls.is_unicom_sim(iccid): # 联通卡
|
|
if cls.is_unicom_sim(iccid): # 联通卡
|
|
@@ -399,13 +400,13 @@ class UnicomComboView(View):
|
|
ip, request_dict,
|
|
ip, request_dict,
|
|
'4G序列号{}绑定{},testFlowPackage{}'.format(serial_no, iccid, result))
|
|
'4G序列号{}绑定{},testFlowPackage{}'.format(serial_no, iccid, result))
|
|
return response.json(0)
|
|
return response.json(0)
|
|
- elif cls.is_dingxin_iot(iccid): # 鼎芯物联卡
|
|
|
|
- params['card_type'] = 5 # 国际
|
|
|
|
|
|
+ elif cls.is_telecom_sim(iccid): # 鼎芯电信
|
|
|
|
+ params['card_type'] = 3
|
|
params['status'] = 2
|
|
params['status'] = 2
|
|
UnicomDeviceInfo.objects.create(**params)
|
|
UnicomDeviceInfo.objects.create(**params)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
- elif cls.is_telecom_sim(iccid): # 鼎芯电信
|
|
|
|
- params['card_type'] = 3
|
|
|
|
|
|
+ elif cls.is_dingxin_iot(iccid): # 鼎芯物联卡
|
|
|
|
+ params['card_type'] = 5 # 国际
|
|
params['status'] = 2
|
|
params['status'] = 2
|
|
UnicomDeviceInfo.objects.create(**params)
|
|
UnicomDeviceInfo.objects.create(**params)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
@@ -418,10 +419,9 @@ class UnicomComboView(View):
|
|
logger.info('--->设备请求绑定{}验证失败'.format(iccid))
|
|
logger.info('--->设备请求绑定{}验证失败'.format(iccid))
|
|
return response.json(173)
|
|
return response.json(173)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
- print(e)
|
|
|
|
- ex = traceback.format_exc()
|
|
|
|
- logger.info('UnicomComboView.iccid_bind_serial_no error{}'.format(ex))
|
|
|
|
- return response.json(177, repr(e))
|
|
|
|
|
|
+ LOGGER.info('*****UnicomComboView.iccid_bind_serial_no:serial_number:{}, errLine:{}, errMsg:{}'
|
|
|
|
+ .format(serial_no, e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
+ return response.json(177, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|
|
def is_telecom_sim(cls, iccid):
|
|
def is_telecom_sim(cls, iccid):
|