|
@@ -102,13 +102,14 @@ class UnicomComboView(View):
|
|
|
combo_order_qs = UnicomComboOrderInfo.objects.filter(iccid=iccid, status=1, is_del=False) \
|
|
|
.values('iccid', 'status', 'combo__status', 'combo__combo_name', 'combo__combo_type',
|
|
|
'combo__flow_total', 'combo__remark', 'combo__expiration_days', 'combo__expiration_type',
|
|
|
- 'year', 'month', 'flow_total_usage', 'expire_time', 'activation_time')
|
|
|
+ 'year', 'month', 'flow_total_usage', 'expire_time', 'activation_time', 'combo__is_unlimited')
|
|
|
if combo_order_qs.exists():
|
|
|
combo_order = combo_order_qs.first()
|
|
|
flow_details = {
|
|
|
'flowInvalid': 0,
|
|
|
'iccid': iccid,
|
|
|
'status': combo_order['status'],
|
|
|
+ 'is_unlimited': combo_order['combo__is_unlimited'],
|
|
|
'comboName': combo_order['combo__combo_name'],
|
|
|
'comboType': combo_order['combo__combo_type'],
|
|
|
'flowTotal': combo_order['combo__flow_total'],
|
|
@@ -162,12 +163,13 @@ class UnicomComboView(View):
|
|
|
combo_order_qs = UnicomComboOrderInfo.objects.filter(iccid=iccid, is_del=False) \
|
|
|
.values('iccid', 'status', 'combo__combo_name', 'combo__flow_total',
|
|
|
'combo__remark', 'combo__expiration_days', 'combo__expiration_type', 'flow_total_usage',
|
|
|
- 'expire_time').order_by('sort')
|
|
|
+ 'expire_time', 'combo__is_unlimited').order_by('sort')
|
|
|
for item in combo_order_qs:
|
|
|
combo_list.append({
|
|
|
'iccid': iccid,
|
|
|
'status': item['status'],
|
|
|
'comboName': item['combo__combo_name'],
|
|
|
+ 'is_unlimited': item['combo__is_unlimited'],
|
|
|
'flowTotal': item['combo__flow_total'],
|
|
|
'comboRemark': item['combo__remark'],
|
|
|
'expirationDays': item['combo__expiration_days'],
|
|
@@ -679,6 +681,11 @@ class UnicomComboView(View):
|
|
|
if status == 1:
|
|
|
unicom_api.change_device_to_activate(iccid)
|
|
|
flow_total_usage = unicom_api.get_flow_usage_total(year, month, iccid)
|
|
|
+ if flow_total_usage > 0:
|
|
|
+ flow_total_usage = Decimal(flow_total_usage)
|
|
|
+ flow_total_usage = flow_total_usage.quantize(Decimal('0.00'))
|
|
|
+ else:
|
|
|
+ flow_total_usage = 0
|
|
|
combo_order_data['flow_total_usage'] = str(flow_total_usage)
|
|
|
UnicomComboOrderInfo.objects.create(**combo_order_data)
|
|
|
logger.info('保存套餐支付信息success')
|