调整广告返回内容

This commit is contained in:
pengtao 2019-08-02 14:45:39 +08:00
parent 68d6e1e326
commit d487d1e910

View File

@ -28,9 +28,7 @@ def send_cache_data():
now = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
all = []
# 添加无天数限定的记录
get_full_data = f"""select a.id,a.name,a.ad_num,a.ad_title,a.ad_body,a.ad_image,a.jump_param,a.ad_sort," \
f"a.companyid,a.gameid,a.channelid,a.jump_status,b.area,b.type,b.mode,b.id from ad a,location b where \
a.locationid=b.id AND a.status=1 AND a.in_used=1 AND begin_time='{BEGIN}' or end_time='{END}'"""
get_full_data = f"""select a.id,a.name,a.ad_num,a.ad_title,a.ad_body,a.ad_image,a.jump_param,a.ad_sort,a.companyid,a.gameid,a.channelid,a.jump_status,b.area,b.type,b.mode,b.id from ad a,location b where a.locationid=b.id AND a.status=1 AND a.in_used=1 AND begin_time='{BEGIN}' or end_time='{END}'"""
full_data = mydb.query(get_full_data)
if full_data:
@ -47,9 +45,7 @@ def send_cache_data():
log.error("split data failed", exc_info=True)
# 添加有天数限定的记录
get_data_sql = f"""select a.id,a.name,a.ad_num,a.ad_title,a.ad_body,a.ad_image,a.jump_param,\
a.ad_sort,a.companyid,a.gameid,a.channelid,a.jump_status,b.area,b.type,b.mode,b.id from ad a ,location b \
where'{now}'>a.begin_time and '{now}'<a.end_time AND a.status=1 AND a.in_used=1 and a.locationid=b.id ;"""
get_data_sql = f"""select a.id,a.name,a.ad_num,a.ad_title,a.ad_body,a.ad_image,a.jump_param,a.ad_sort,a.companyid,a.gameid,a.channelid,a.jump_status,b.area,b.type,b.mode,b.id from ad a ,location b where'{now}'>a.begin_time and '{now}'<a.end_time AND a.status=1 AND a.in_used=1 and a.locationid=b.id ;"""
data = mydb.query(get_data_sql)
if data: