|
@@ -233,16 +233,11 @@ class UnicomManageControllerView(View):
|
|
unicom_device_qs = unicom_device_qs[(page - 1) * line:page * line]
|
|
unicom_device_qs = unicom_device_qs[(page - 1) * line:page * line]
|
|
list_data = []
|
|
list_data = []
|
|
for unicom_device in unicom_device_qs:
|
|
for unicom_device in unicom_device_qs:
|
|
- data = {
|
|
|
|
- 'iccid': unicom_device.iccid,
|
|
|
|
- 'serialNo': unicom_device.serial_no,
|
|
|
|
- 'userID': unicom_device.user_id,
|
|
|
|
- 'cardType': unicom_device.card_type,
|
|
|
|
- 'status': unicom_device.status,
|
|
|
|
- 'mainCard': unicom_device.main_card,
|
|
|
|
- 'createdTime': unicom_device.created_time,
|
|
|
|
- 'updatedTime': unicom_device.updated_time
|
|
|
|
- }
|
|
|
|
|
|
+ data = {'iccid': unicom_device.iccid, 'serialNo': unicom_device.serial_no,
|
|
|
|
+ 'userID': unicom_device.user_id, 'cardType': unicom_device.card_type,
|
|
|
|
+ 'status': unicom_device.status, 'mainCard': unicom_device.main_card,
|
|
|
|
+ 'createdTime': unicom_device.created_time, 'updatedTime': unicom_device.updated_time,
|
|
|
|
+ 'cardStatus': self.get_device_status_by_iccid(unicom_device.iccid, unicom_device.card_type)}
|
|
device_user_qs = Device_User.objects.filter(userID=unicom_device.user_id).values('username', 'NickName',
|
|
device_user_qs = Device_User.objects.filter(userID=unicom_device.user_id).values('username', 'NickName',
|
|
'phone')
|
|
'phone')
|
|
data['userName'] = device_user_qs[0]['username'] if device_user_qs.exists() else ''
|
|
data['userName'] = device_user_qs[0]['username'] if device_user_qs.exists() else ''
|
|
@@ -827,3 +822,20 @@ class UnicomManageControllerView(View):
|
|
except Exception as e:
|
|
except Exception as e:
|
|
print(repr(e))
|
|
print(repr(e))
|
|
return []
|
|
return []
|
|
|
|
+
|
|
|
|
+ @staticmethod
|
|
|
|
+ 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:
|
|
|
|
+ return 'N/A'
|