This commit is contained in:
pengtao 2019-09-16 15:45:23 +08:00
parent 08c1330d34
commit 36bea5a043

View File

@ -25,7 +25,7 @@ def get_area_by_locationid(ldid):
data = mydb.query(sql) data = mydb.query(sql)
if data: if data:
for line in data: for line in data:
area.append(line[0].replace('[','').replace(']','').replace('"',"")) area.append(line[0])
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
@ -113,9 +113,9 @@ def send_cache_data():
item.get('ad_property', {}).replace("", '"').replace("", '"')) item.get('ad_property', {}).replace("", '"').replace("", '"'))
item['ad_property'].update(temp) item['ad_property'].update(temp)
item['ad_property'] = json.dumps(item['ad_property']) item['ad_property'] = json.dumps(item['ad_property'])
all.append(item)
except Exception: except Exception:
log.error(f"write {item}", exc_info=True) log.error(f"write {item}", exc_info=True)
all.append(item)
except Exception: except Exception:
log.error("split data failed", exc_info=True) log.error("split data failed", exc_info=True)
# 检查ID是否存在播放列表中以及播放次数是否完毕 # 检查ID是否存在播放列表中以及播放次数是否完毕
@ -127,6 +127,7 @@ def send_cache_data():
locationid = json.loads(line.get('locationid')) locationid = json.loads(line.get('locationid'))
for item in locationid: for item in locationid:
area = get_area_by_locationid(item) area = get_area_by_locationid(item)
pdb.set_trace()
for area_temp in area: for area_temp in area:
for one in area_temp.split(","): for one in area_temp.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}"