|
@@ -304,7 +304,7 @@ class UnicomObjeect:
|
|
|
def get_flow_usage_total(iccid, card_type=0):
|
|
|
"""
|
|
|
查询当前卡号历史总用量,默认查询珠海联通卡总使用量,单位MB
|
|
|
- @param card_type: 卡类型,0:珠海联通,1:鼎芯电信
|
|
|
+ @param card_type: 卡类型,0:珠海联通,3:鼎芯电信
|
|
|
@param iccid: 20位卡号
|
|
|
@return: flow_total_usage 当前套餐总已使用流量
|
|
|
"""
|
|
@@ -317,12 +317,23 @@ class UnicomObjeect:
|
|
|
return UnicomObjeect().get_flow_total_usage(flow_key.format(iccid), expire_time, **usage_data)
|
|
|
|
|
|
@staticmethod
|
|
|
- def change_device_to_activate(iccid):
|
|
|
+ def change_device_to_activate(iccid, card_type=0, access_number='', reason=''):
|
|
|
"""
|
|
|
根据iccid判断是否激活,未激活则修改为激活状态
|
|
|
- @param iccid:
|
|
|
+ @param reason: 原因
|
|
|
+ @param access_number: 11位接入号码
|
|
|
+ @param card_type: 0:联通,1:鼎芯电信
|
|
|
+ @param iccid: 20位ICCID
|
|
|
@return:
|
|
|
"""
|
|
|
+ if card_type == 3 and access_number:
|
|
|
+ return TelecomService.update_access_number_network(iccid, access_number, 'DEL', reason)
|
|
|
+ card_info = UnicomDeviceInfo.objects.filter(iccid=iccid).values('card_type', 'access_number')
|
|
|
+ if not card_info.exists():
|
|
|
+ return None
|
|
|
+ if card_info[0]['card_type'] == 3:
|
|
|
+ TelecomService.update_access_number_network(iccid, card_info[0]['access_number'], 'DEL')
|
|
|
+ return True
|
|
|
if iccid:
|
|
|
re_data = {'iccid': iccid}
|
|
|
result = UnicomObjeect().query_device_status(**re_data)
|
|
@@ -335,12 +346,23 @@ class UnicomObjeect:
|
|
|
return None
|
|
|
|
|
|
@staticmethod
|
|
|
- def change_device_to_disable(iccid):
|
|
|
+ def change_device_to_disable(iccid, card_type=0, access_number='', reason=''):
|
|
|
"""
|
|
|
修改设备为停用,并查看是否修改成功
|
|
|
- @param iccid:
|
|
|
+ @param reason: 原因
|
|
|
+ @param access_number: 11位接入号码
|
|
|
+ @param card_type: 0:联通,1:鼎芯电信
|
|
|
+ @param iccid: 20位ICCID
|
|
|
@return:
|
|
|
"""
|
|
|
+ if card_type == 3 and access_number:
|
|
|
+ return TelecomService.update_access_number_network(iccid, access_number, 'ADD', reason)
|
|
|
+ card_info = UnicomDeviceInfo.objects.filter(iccid=iccid).values('card_type', 'access_number')
|
|
|
+ if not card_info.exists():
|
|
|
+ return None
|
|
|
+ if card_info[0]['card_type'] == 3:
|
|
|
+ TelecomService.update_access_number_network(iccid, card_info[0]['access_number'], 'ADD')
|
|
|
+ return True
|
|
|
if iccid:
|
|
|
re_data = {"iccid": iccid, "status": 3}
|
|
|
response = UnicomObjeect().update_device_state(**re_data)
|