fix
This commit is contained in:
parent
bab0a27232
commit
71f5cd2550
36
ad_tasks.py
36
ad_tasks.py
@ -121,26 +121,26 @@ def send_cache_data():
|
|||||||
if all:
|
if all:
|
||||||
# log.info(f"get data was {all}!\n")
|
# log.info(f"get data was {all}!\n")
|
||||||
for line in all:
|
for line in all:
|
||||||
locationid = json.loads(line.get('locationid'))
|
if line:
|
||||||
for item in locationid:
|
locationid = json.loads(line.get('locationid'))
|
||||||
pdb.set_trace()
|
for item in locationid:
|
||||||
area = get_area_by_locationid(item)
|
area = get_area_by_locationid(item)
|
||||||
for one in area:
|
for one in area:
|
||||||
key = f"ad::{line.get('gameid', 0)}::{line.get('channelid', 0)}::{one}::{item}"
|
key = f"ad::{line.get('gameid', 0)}::{line.get('channelid', 0)}::{one}::{item}"
|
||||||
if int(line['ad_num']) == 0:
|
if int(line['ad_num']) == 0:
|
||||||
sadd_adkey(key, line, item)
|
|
||||||
elif int(line['ad_num']) > 0:
|
|
||||||
num = my_redis.get(f"adnum::{line['id']}::num")
|
|
||||||
if not num:
|
|
||||||
num = 0
|
|
||||||
if int(line['ad_num']) > int(num):
|
|
||||||
sadd_adkey(key, line, item)
|
sadd_adkey(key, line, item)
|
||||||
|
elif int(line['ad_num']) > 0:
|
||||||
|
num = my_redis.get(f"adnum::{line['id']}::num")
|
||||||
|
if not num:
|
||||||
|
num = 0
|
||||||
|
if int(line['ad_num']) > int(num):
|
||||||
|
sadd_adkey(key, line, item)
|
||||||
|
else:
|
||||||
|
if my_redis.sismember(key, line['id']):
|
||||||
|
my_redis.srem(key, line['id'])
|
||||||
|
log.info(f"remove {line['id']} from {key}!")
|
||||||
else:
|
else:
|
||||||
if my_redis.sismember(key, line['id']):
|
log.error(f"get ad_num from mysql failed! ad_num={line['ad_num']}")
|
||||||
my_redis.srem(key, line['id'])
|
|
||||||
log.info(f"remove {line['id']} from {key}!")
|
|
||||||
else:
|
|
||||||
log.error(f"get ad_num from mysql failed! ad_num={line['ad_num']}")
|
|
||||||
|
|
||||||
# 删除过期的数据
|
# 删除过期的数据
|
||||||
log.info("remove expire data from cache!")
|
log.info("remove expire data from cache!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user