From 7a05e45ab264df2e8399ce47b9a0c115658f72d4 Mon Sep 17 00:00:00 2001 From: pengtao Date: Wed, 17 Jul 2019 17:53:03 +0800 Subject: [PATCH] =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=9D=A1=E6=95=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ad_interface_tornado.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ad_interface_tornado.py b/ad_interface_tornado.py index 952ce88..21d48fa 100644 --- a/ad_interface_tornado.py +++ b/ad_interface_tornado.py @@ -61,14 +61,16 @@ def send_cache_data(): # log.info(f"get data was {all}!\n") for line in all: key = f"ad::{line.get('gameid', 0)}::{line.get('locationid', 0)}" + if int(line['ad_num']) > 0: num = my_redis.get(f"ad::{line['id']}::num") + print(f"1 ={line['ad_num']},2={num}") if not num: num = 0 if int(line['ad_num']) > int(num): my_redis.sadd(key, line['id']) my_redis.expire(key, 120) - n = int(line['ad_num'] - num) + n = int(line['ad_num']) - int(num) log.info(f"add {line['id']} to {key} ,num was {line['ad_num']},limit was {n}!") else: my_redis.srem(key, line['id'])