添加广告按gameid查询
This commit is contained in:
parent
644ad943ea
commit
7d55b1f2e5
@ -49,62 +49,14 @@ class Ad(Resource):
|
|||||||
status = self.args['status']
|
status = self.args['status']
|
||||||
id = self.args['id']
|
id = self.args['id']
|
||||||
companyid = self.args['companyid']
|
companyid = self.args['companyid']
|
||||||
|
gameid = self.args['gameid']
|
||||||
# if not gameid or not localid:
|
# if not gameid or not localid:
|
||||||
# # log.error(f"请输入必须的游戏ID和位置ID字段,当前获得是{gameid},{localid}")
|
# # log.error(f"请输入必须的游戏ID和位置ID字段,当前获得是{gameid},{localid}")
|
||||||
# return jsonify({'code': 500, "message": f"请输入必须的游戏ID和位置ID字段,当前获得是{gameid},{localid},{status}"})
|
# return jsonify({'code': 500, "message": f"请输入必须的游戏ID和位置ID字段,当前获得是{gameid},{localid},{status}"})
|
||||||
|
|
||||||
# now = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
# now = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
if not id:
|
if not id:
|
||||||
if companyid:
|
base_sql = """SELECT
|
||||||
sel_sql = f"""select
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
begin_time,
|
|
||||||
end_time,
|
|
||||||
ad_num,
|
|
||||||
ad_title,
|
|
||||||
ad_body,
|
|
||||||
ad_image,
|
|
||||||
jump_param,
|
|
||||||
ad_sort,
|
|
||||||
status,
|
|
||||||
companyid,
|
|
||||||
locationid,
|
|
||||||
gameid,
|
|
||||||
channelid,
|
|
||||||
jump_status,
|
|
||||||
ad_property
|
|
||||||
from
|
|
||||||
ad
|
|
||||||
where
|
|
||||||
in_used=1
|
|
||||||
and companyid={companyid};"""
|
|
||||||
elif status or status == 0:
|
|
||||||
sel_sql = f"""select
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
begin_time,
|
|
||||||
end_time,
|
|
||||||
ad_num,
|
|
||||||
ad_title,
|
|
||||||
ad_body,
|
|
||||||
ad_image,
|
|
||||||
jump_param,
|
|
||||||
ad_sort,
|
|
||||||
status,
|
|
||||||
companyid,
|
|
||||||
locationid,
|
|
||||||
gameid,
|
|
||||||
channelid,
|
|
||||||
jump_status,
|
|
||||||
ad_property
|
|
||||||
from
|
|
||||||
ad
|
|
||||||
where
|
|
||||||
in_used=1
|
|
||||||
and status={status};"""
|
|
||||||
else:
|
|
||||||
sel_sql = f"""select
|
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
begin_time,
|
begin_time,
|
||||||
@ -122,10 +74,20 @@ class Ad(Resource):
|
|||||||
channelid,
|
channelid,
|
||||||
jump_status,
|
jump_status,
|
||||||
ad_property
|
ad_property
|
||||||
from
|
FROM
|
||||||
ad
|
ad
|
||||||
where
|
WHERE
|
||||||
in_used=1 ;"""
|
in_used=1 """
|
||||||
|
|
||||||
|
if companyid:
|
||||||
|
sel_sql = f"{base_sql} and companyid={companyid}"
|
||||||
|
else:
|
||||||
|
sel_sql = f"{base_sql}"
|
||||||
|
if status:
|
||||||
|
sel_sql = f"{sel_sql} and status={status}"
|
||||||
|
if gameid:
|
||||||
|
sel_sql = f"{sel_sql} and gameid={gameid}"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
sel_sql = f"""select
|
sel_sql = f"""select
|
||||||
id,
|
id,
|
||||||
@ -258,7 +220,7 @@ class Ad(Resource):
|
|||||||
if not id:
|
if not id:
|
||||||
return jsonify({'code': 404, 'message': f'{id} not found!'})
|
return jsonify({'code': 404, 'message': f'{id} not found!'})
|
||||||
#del_sql = f"delete from ad where id={id};"
|
#del_sql = f"delete from ad where id={id};"
|
||||||
del_sql = f"update ad set status=4 where id={id};"
|
del_sql = f"update ad set in_used=0 where id={id};"
|
||||||
try:
|
try:
|
||||||
self.mydb.change(del_sql)
|
self.mydb.change(del_sql)
|
||||||
return jsonify({'code': 200, 'message': f'remove adid={id} success!'})
|
return jsonify({'code': 200, 'message': f'remove adid={id} success!'})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user