调整逻辑

This commit is contained in:
pengtao 2019-09-29 12:16:46 +08:00
parent c6cdd1f6e7
commit 4a62f9a8f0

View File

@ -124,7 +124,7 @@ def produce_task():
if all:
for line in all:
if line:
print(f"line={line}")
# print(f"line={line}")
try:
locationids = json.loads(line.get('locationid'))
for locationid in str(locationids).strip('[]').split(','):
@ -138,11 +138,13 @@ def produce_task():
key = "ad::{0}::{1}::{2}".format(str01, area, locationid)
if int(line['ad_num']) == 0:
sadd_adkey(key, line)
print(f"add {line} 2 {key}!")
elif int(line['ad_num']) > 0:
num = my_redis.get(f"adnum::{line['id']}_{locationid}::num") or 0
print(f" get {line['id']} {locationid} num was {num}!")
if int(line['ad_num']) > int(num):
sadd_adkey(key, line)
print(f"add {line} 2 {key}!")
else:
redis_key = f"{line['id']}_{locationid}"
if my_redis.sismember(key, redis_key):