|
@@ -165,25 +165,29 @@ class UnicomComboTaskView(View):
|
|
|
@param app_user_id: app用户id
|
|
|
@param serial_no: 序列号
|
|
|
@param combo_order_id: 当前套餐订单id
|
|
|
- @param flow_total: 流量总量
|
|
|
- @param flow_usage: 已使用流量
|
|
|
+ @param flow_total: 套餐流量总量
|
|
|
+ @param flow_usage: 套餐已使用流量
|
|
|
@return:
|
|
|
"""
|
|
|
logger = logging.getLogger('info')
|
|
|
try:
|
|
|
if not app_user_id:
|
|
|
return False
|
|
|
+ now_time = int(time.time())
|
|
|
+ push_data = {'combo_order_id': str(combo_order_id), 'serial_no': serial_no,
|
|
|
+ 'flow_total_usage': flow_usage, 'flow_total': flow_total, 'status': 0,
|
|
|
+ 'updated_time': now_time,
|
|
|
+ 'created_time': now_time, 'user_id': app_user_id}
|
|
|
if 0 < flow_total and 0 < flow_usage < flow_total:
|
|
|
res = flow_usage / flow_total * 100
|
|
|
if 85 < res <= 95:
|
|
|
flow_push = UnicomFlowPush.objects.filter(serial_no=serial_no, combo_order_id=combo_order_id)
|
|
|
if not flow_push.exists():
|
|
|
- now_time = int(time.time())
|
|
|
- push_data = {'combo_order_id': str(combo_order_id), 'serial_no': serial_no,
|
|
|
- 'flow_total_usage': flow_usage, 'flow_total': flow_total, 'status': 0,
|
|
|
- 'updated_time': now_time,
|
|
|
- 'created_time': now_time, 'user_id': app_user_id}
|
|
|
UnicomFlowPush.objects.create(**push_data)
|
|
|
+ elif flow_usage >= flow_total:
|
|
|
+ push_data['flow_total_usage'] = flow_total
|
|
|
+ push_data['type'] = 1
|
|
|
+ UnicomFlowPush.objects.create(**push_data)
|
|
|
return True
|
|
|
except Exception as e:
|
|
|
logger.info('出错了~异常流量监控,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|