|
@@ -57,6 +57,8 @@ class UnicomComboTaskView(View):
|
|
|
return response.json(0)
|
|
|
elif operation == 'queryFlowUsedHistory':
|
|
|
return self.query_flow_used_history(response)
|
|
|
+ elif operation == 'queryFlowCache':
|
|
|
+ return self.query_flow_cache(response)
|
|
|
|
|
|
@classmethod
|
|
|
def check_activate_combo(cls, request_dict, response):
|
|
@@ -390,3 +392,23 @@ class UnicomComboTaskView(View):
|
|
|
# 批量创建IotCardUsageHistory对象
|
|
|
if iot_card_list:
|
|
|
IotCardUsageHistory.objects.bulk_create(iot_card_list)
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def query_flow_cache(cls, response):
|
|
|
+ """
|
|
|
+ 查询流量缓存永久的将设置过期时间为10分钟
|
|
|
+ """
|
|
|
+ redis = RedisObject()
|
|
|
+ try:
|
|
|
+ res = redis.get_keys('ASJ:UNICOM:FLOW:*')
|
|
|
+ keys = [key.decode() for key in res]
|
|
|
+ # 进行进一步的处理或打印
|
|
|
+ for key in keys:
|
|
|
+ ttl = redis.get_ttl(key)
|
|
|
+ if ttl == -1:
|
|
|
+ logger.info('iccidFlow:{}'.format(key))
|
|
|
+ redis.CONN.expire(key, 60 * 10)
|
|
|
+ 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))
|