调整adid_localtionid 为主键

This commit is contained in:
pengtao 2019-09-16 20:27:37 +08:00
parent c3de26f2e8
commit 4a43711e1d

View File

@ -33,11 +33,11 @@ def get_area_by_locationid(ldid):
def split_ad_info(localtionid, line): def split_ad_info(localtionid, line):
# 从locationid获取位置相关属性与ad信息打包产生提供给接口用的数据 # 从locationid获取位置相关属性与ad信息打包产生提供给接口用的数据
new = copy.deepcopy(line) new = copy.deepcopy(line)
location_sql = f"select area,x,y,x_offset,y_offset,type,mode,ld_property from location WHERE in_used=1 and id={localtionid}" location_sql = f"select x,y,x_offset,y_offset,type,mode,ld_property from location WHERE in_used=1 and id={localtionid}"
data = mydb.query(location_sql) data = mydb.query(location_sql)
try: try:
new['area'], new['x'], new['y'], new['x_offset'], new['y_offset'], new['type'], new['mode'], new[ new['x'], new['y'], new['x_offset'], new['y_offset'], new['type'], new['mode'], new['ld_property'] = data[0]
'ld_property'] = data[0] new['area'] = f"{new['area']},{new['x']},{new['y']},{new['x_offset']},{new['y_offset']}"
except Exception: except Exception:
log.error(f"get localtion info by sql={location_sql} error!", exc_info=True) log.error(f"get localtion info by sql={location_sql} error!", exc_info=True)
return None return None
@ -129,6 +129,10 @@ def send_cache_data():
for item in locationid: for item in locationid:
area = get_area_by_locationid(item) area = get_area_by_locationid(item)
for one in area.split(','): for one in area.split(','):
line['locationid'] = item
line['area'] = one
key = f"ad::{line.get('gameid', 0)}_{item}::{line.get('channelid', 0)}::{one}::{item}" key = f"ad::{line.get('gameid', 0)}_{item}::{line.get('channelid', 0)}::{one}::{item}"
if int(line['ad_num']) == 0: if int(line['ad_num']) == 0:
sadd_adkey(key, line, item) sadd_adkey(key, line, item)