This commit is contained in:
pengtao 2019-09-16 16:59:19 +08:00
parent 2b4627a062
commit 36f2ebbc07

View File

@ -24,7 +24,7 @@ def get_area_by_locationid(ldid):
sql = f"select area from location where id={ldid}" sql = f"select area from location where id={ldid}"
data = mydb.query(sql) data = mydb.query(sql)
if data: if data:
return data[0][0] return data[0][0].replace("[", "").replace("]", "").replace('"', "")
else: else:
log.error(f"get area from location failed!,sql={sql}") log.error(f"get area from location failed!,sql={sql}")
return area return area
@ -119,13 +119,13 @@ def send_cache_data():
log.error("split data failed", exc_info=True) log.error("split data failed", exc_info=True)
# 检查ID是否存在播放列表中以及播放次数是否完毕 # 检查ID是否存在播放列表中以及播放次数是否完毕
if all: if all:
pdb.set_trace()
# log.info(f"get data was {all}!\n") # log.info(f"get data was {all}!\n")
for line in all: for line in all:
if line: if line:
print(f"1={line}") print(f"1={line}")
locationid = json.loads(line.get('locationid')) locationid = json.loads(line.get('locationid'))
for item in locationid: for item in locationid:
pdb.set_trace()
area = get_area_by_locationid(item) area = get_area_by_locationid(item)
for one in area.split(','): for one in area.split(','):
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}"