添加返回条数控制
This commit is contained in:
parent
edc10bcb95
commit
fb0ef6cf7b
@ -61,11 +61,11 @@ def send_cache_data():
|
|||||||
# log.info(f"get data was {all}!\n")
|
# log.info(f"get data was {all}!\n")
|
||||||
for line in all:
|
for line in all:
|
||||||
key = f"ad::{line.get('gameid', 0)}::{line.get('locationid', 0)}"
|
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")
|
num = my_redis.get(f"ad::{line['id']}::num")
|
||||||
if not num:
|
if not num:
|
||||||
num = 0
|
num = 0
|
||||||
if line['ad_num'] > num:
|
if int(line['ad_num']) > int(num):
|
||||||
my_redis.sadd(key, line['id'])
|
my_redis.sadd(key, line['id'])
|
||||||
my_redis.expire(key, 120)
|
my_redis.expire(key, 120)
|
||||||
n = int(line['ad_num'] - num)
|
n = int(line['ad_num'] - num)
|
||||||
@ -73,7 +73,7 @@ def send_cache_data():
|
|||||||
else:
|
else:
|
||||||
my_redis.srem(key, line['id'])
|
my_redis.srem(key, line['id'])
|
||||||
log.info(f"remove {line['id']} from {key}!")
|
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.sadd(key, line['id'])
|
||||||
my_redis.expire(key, 120)
|
my_redis.expire(key, 120)
|
||||||
log.info(f"add {line['id']} to {key} ,num was unlimit !")
|
log.info(f"add {line['id']} to {key} ,num was unlimit !")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user