调整广告返回内容

This commit is contained in:
pengtao 2019-08-02 17:06:33 +08:00
parent b7bd6557c9
commit 9ca09a447d
2 changed files with 97 additions and 2 deletions

View File

@ -35,6 +35,9 @@ http://ad.kingsome.cn/webapp/index.php?c=Ops&a=getAdList&body={"gameid":"1004:60
| name | string | 是 | 广告名称 |
| jump_status | int | 是 | 跳转状态1=跳转0=不跳 |
| jump_param | string | 是 | 跳转参数 |
| area | string | 是 | 区域(第一元素1=首页2=游戏中3=结算页4=关闭第二元素X轴第三元素Y轴其中X,Y取值范围0,15)如1,0,0代表首页左上 |
| type | int | 是 | 类型1=icon2=banner3=浮窗) |
| mode | int | 是 | 广告单播或轮播模式1=单播2=轮播) |
##### 返回示例

View File

@ -28,7 +28,52 @@ 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,a.companyid,a.gameid,a.channelid,a.jump_status,b.area,b.type,b.mode,a.locationid from ad a,location b where a.locationid=b.id AND a.status=1 AND a.in_used=1 AND a.begin_time='{BEGIN}' or a.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,
a.locationid
FROM
(SELECT
id,
name,
ad_num,
ad_title,
ad_body,
ad_image,
jump_param,
ad_sort,
companyid,
gameid,
channelid,
jump_status,
locationid
FROM
ad
WHERE
status=1
AND in_used=1 AND (begin_time='{BEGIN}' OR end_time='{END}')) a ,
(SELECT
id,
area,
type,
mode
FROM
location) b
WHERE
a.locationid=b.id"""
full_data = mydb.query(get_full_data)
if full_data:
@ -45,7 +90,54 @@ 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,a.locationid 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,
a.locationid
from
(select
id,
name,
ad_num,
ad_title,
ad_body,
ad_image,
jump_param,
ad_sort,
companyid,
gameid,
channelid,
jump_status,
locationid
from
ad
where
status=1
and in_used=1
and '{now}'> begin_time
and '{now}'<end_time ) a ,
(select
id,
area,
type,
mode
from
location) b
where
a.locationid=b.id"""
data = mydb.query(get_data_sql)
if data: