diff --git a/ad_interface_tornado.py b/ad_interface_tornado.py index c8f99ad..952ce88 100644 --- a/ad_interface_tornado.py +++ b/ad_interface_tornado.py @@ -61,11 +61,11 @@ 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 line['ad_num'] > 0: + if int(line['ad_num']) > 0: num = my_redis.get(f"ad::{line['id']}::num") if not num: num = 0 - if line['ad_num'] > num: + if int(line['ad_num']) > int(num): my_redis.sadd(key, line['id']) my_redis.expire(key, 120) n = int(line['ad_num'] - num) @@ -73,7 +73,7 @@ def send_cache_data(): else: my_redis.srem(key, line['id']) log.info(f"remove {line['id']} from {key}!") - elif line['ad_num'] == 0: + elif int(line['ad_num']) == 0: my_redis.sadd(key, line['id']) my_redis.expire(key, 120) log.info(f"add {line['id']} to {key} ,num was unlimit !")