|
@@ -119,10 +119,23 @@ class UnicomComboTaskView(View):
|
|
|
"""
|
|
|
logger.info('--->进入监控流量使用情况')
|
|
|
try:
|
|
|
- unicom_api = UnicomObjeect()
|
|
|
combo_order_qs = UnicomComboOrderInfo.objects.filter(status=1, is_del=False, combo__is_unlimited=0).values()
|
|
|
if not combo_order_qs.exists():
|
|
|
return response.json(0)
|
|
|
+ asy = threading.Thread(target=UnicomComboTaskView.async_monitoring_flow, args=(combo_order_qs,))
|
|
|
+ asy.start()
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ logger.info('出错了~检测流量用量详情异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+ return response.json(177, repr(e))
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def async_monitoring_flow(cls, combo_order_qs):
|
|
|
+ """
|
|
|
+ 异步检测流量使用详情
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ unicom_api = UnicomObjeect()
|
|
|
today = datetime.datetime.today()
|
|
|
year = today.year
|
|
|
month = today.month
|
|
@@ -164,11 +177,8 @@ class UnicomComboTaskView(View):
|
|
|
if not activate_status:
|
|
|
# 停用
|
|
|
unicom_api.change_device_to_disable(iccid)
|
|
|
-
|
|
|
- return response.json(0)
|
|
|
except Exception as e:
|
|
|
- logger.info('出错了~检测流量用量详情异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
- return response.json(177, repr(e))
|
|
|
+ logger.info('异步~检测流量用量详情异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
|
|
|
@staticmethod
|
|
|
def flow_warning_push(app_user_id, serial_no, combo_order_id, flow_total, flow_usage):
|