|
@@ -129,7 +129,7 @@ class UnicomComboView(View):
|
|
|
flow_details['usableFlow'] = 0 if flow == 0 else flow
|
|
|
flow_details['usableFlow'] = \
|
|
|
flow_details['flowTotal'] if flow_details['usableFlow'] > flow_details['flowTotal'] else \
|
|
|
- flow_details['usableFlow']
|
|
|
+ flow_details['usableFlow']
|
|
|
flow_details['usableFlow'] = Decimal(flow_details['usableFlow']).quantize(Decimal('0.00'))
|
|
|
flow_details.pop('flowTotalUsage')
|
|
|
cls.update_combo_order_sort(iccid)
|
|
@@ -309,10 +309,12 @@ class UnicomComboView(View):
|
|
|
redis = RedisObject()
|
|
|
with transaction.atomic():
|
|
|
# 待完善代码 根据uid与用户id验证系统设备
|
|
|
- unicom_device_qs = UnicomDeviceInfo.objects.filter(iccid=iccid)
|
|
|
+ unicom_device_qs = UnicomDeviceInfo.objects.filter(serial_no=serial_no)
|
|
|
if unicom_device_qs.exists():
|
|
|
- unicom_device_qs.update(main_card=sim, updated_time=n_time)
|
|
|
- if unicom_device_qs.first().status == 1 and unicom_device_qs.first().serial_no == serial_no:
|
|
|
+ if sim == 0:
|
|
|
+ unicom_device_qs.update(main_card=sim, updated_time=n_time)
|
|
|
+ return response.json(0, '切卡修改{}成功'.format(serial_no))
|
|
|
+ if unicom_device_qs.first().status == 1:
|
|
|
key = 'ASJ:UNICOM:RESET:{}'.format(serial_no)
|
|
|
reset_cache = redis.get_data(key)
|
|
|
if reset_cache:
|
|
@@ -320,6 +322,8 @@ class UnicomComboView(View):
|
|
|
return response.json(0, 'Thirty minutes later to visit again take effect')
|
|
|
cls.user_activate_flow(iccid)
|
|
|
return response.json(0)
|
|
|
+ if sim == 0:
|
|
|
+ return response.json(0, '外置卡不保存相关信息{}'.format(serial_no))
|
|
|
unicom_obj = UnicomObjeect()
|
|
|
result = unicom_obj.verify_device(iccid=iccid)
|
|
|
if result.status_code == 200 and result.text:
|