|
@@ -138,10 +138,13 @@ class UnicomComboView(View):
|
|
|
serial_no = unicom_device_info_qs[0].serial_no
|
|
|
cls.experience_order_4G(iccid, serial_no, user_id) # 生成4G体验订单
|
|
|
unicom_api = UnicomObjeect()
|
|
|
+
|
|
|
+ # 查询正在生效套餐
|
|
|
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', 'combo__is_unlimited')
|
|
|
+
|
|
|
if combo_order_qs.exists():
|
|
|
combo_order = combo_order_qs.first()
|
|
|
flow_details = {
|
|
@@ -157,7 +160,7 @@ class UnicomComboView(View):
|
|
|
'expirationType': combo_order['combo__expiration_type'],
|
|
|
'flowTotalUsage': combo_order['flow_total_usage'],
|
|
|
'activationTime': combo_order['activation_time'],
|
|
|
- 'expireTime': combo_order['expire_time'],
|
|
|
+ 'expireTime': -1 if combo_order['combo__remark'] == 'LIFETIME_FREE' else combo_order['expire_time'],
|
|
|
'year': combo_order['year'],
|
|
|
'month': combo_order['month'],
|
|
|
}
|
|
@@ -171,8 +174,10 @@ class UnicomComboView(View):
|
|
|
else flow_details['usableFlow']
|
|
|
flow_details['usableFlow'] = Decimal(flow_details['usableFlow']).quantize(Decimal('0.00'))
|
|
|
flow_details.pop('flowTotalUsage')
|
|
|
- cls.update_combo_order_sort(iccid)
|
|
|
- flow_details['comboList'] = cls.get_combo_order_list(iccid)
|
|
|
+
|
|
|
+ cls.update_combo_order_sort(iccid) # 排序
|
|
|
+
|
|
|
+ flow_details['comboList'] = cls.get_combo_order_list(iccid) # 获取当前上架套餐
|
|
|
return response.json(0, flow_details)
|
|
|
else:
|
|
|
flow_details = {'iccid': iccid, 'flowInvalid': 1, 'comboList': cls.get_combo_order_list(iccid)}
|
|
@@ -252,9 +257,9 @@ class UnicomComboView(View):
|
|
|
'isUnlimited': item['combo__is_unlimited'],
|
|
|
'flowTotal': item['combo__flow_total'],
|
|
|
'comboRemark': item['combo__remark'],
|
|
|
- 'expirationDays': item['combo__expiration_days'],
|
|
|
+ 'expirationDays': 0,
|
|
|
'expirationType': item['combo__expiration_type'],
|
|
|
- 'expireTime': item['expire_time'],
|
|
|
+ 'expireTime': -1 if item['combo__remark'] == 'LIFETIME_FREE' else item['expire_time']
|
|
|
})
|
|
|
return combo_list
|
|
|
|
|
@@ -1112,7 +1117,7 @@ class UnicomComboView(View):
|
|
|
'store_meal_name': combo_info_vo['combo_name']
|
|
|
}
|
|
|
|
|
|
- orderID=Order_Model.objects.create(**order_dict)
|
|
|
+ orderID = Order_Model.objects.create(**order_dict)
|
|
|
LOGGER.info(f'4G套餐订单创建成功 orderID:{orderID}, orders表写入数据')
|
|
|
|
|
|
# 创建4G套餐信息记录
|