|
@@ -825,17 +825,21 @@ class UnicomManageControllerView(View):
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def get_device_status_by_iccid(iccid, card_type):
|
|
def get_device_status_by_iccid(iccid, card_type):
|
|
- re_data = {'iccid': iccid}
|
|
|
|
- if card_type == 0:
|
|
|
|
- status_dict = {1: '已激活', 2: '可激活', 3: '已停用', 4: '已失效', 5: '可测试', 6: '库存', 7: '已更换', 8: '已清除'}
|
|
|
|
- result = UnicomObjeect().query_device_status(**re_data)
|
|
|
|
- res_dict = UnicomObjeect().get_text_dict(result)
|
|
|
|
- return status_dict.get(int(res_dict['data']['status']), 'N/A')
|
|
|
|
- elif card_type == 1:
|
|
|
|
- status_dict = {1: '库存', 2: '可激活', 3: '已激活', 4: '已停用', 5: '已失效', 6: '强制停机'}
|
|
|
|
- data = {'iccid': iccid, 'operator': 3}
|
|
|
|
- wx_tech = WXTechObject()
|
|
|
|
- result = wx_tech.get_cards_info(**data)
|
|
|
|
- return status_dict.get(int(result['data']['cardStatusCode']), 'N/A')
|
|
|
|
- else:
|
|
|
|
|
|
+ try:
|
|
|
|
+ re_data = {'iccid': iccid}
|
|
|
|
+ if card_type == 0:
|
|
|
|
+ status_dict = {1: '已激活', 2: '可激活', 3: '已停用', 4: '已失效', 5: '可测试', 6: '库存', 7: '已更换', 8: '已清除'}
|
|
|
|
+ result = UnicomObjeect().query_device_status(**re_data)
|
|
|
|
+ res_dict = UnicomObjeect().get_text_dict(result)
|
|
|
|
+ return status_dict.get(int(res_dict['data']['status']), 'N/A')
|
|
|
|
+ elif card_type == 1:
|
|
|
|
+ status_dict = {1: '库存', 2: '可激活', 3: '已激活', 4: '已停用', 5: '已失效', 6: '强制停机'}
|
|
|
|
+ data = {'iccid': iccid, 'operator': 3}
|
|
|
|
+ wx_tech = WXTechObject()
|
|
|
|
+ result = wx_tech.get_cards_info(**data)
|
|
|
|
+ return status_dict.get(int(result['data']['cardStatusCode']), 'N/A')
|
|
|
|
+ else:
|
|
|
|
+ return 'N/A'
|
|
|
|
+ except Exception as e:
|
|
|
|
+ print(repr(e))
|
|
return 'N/A'
|
|
return 'N/A'
|