From 0f808baf02dd9fb6ae60e6d554ebc7663394456e Mon Sep 17 00:00:00 2001 From: pengtao Date: Thu, 25 Jul 2019 17:12:37 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BD=8D=E7=BD=AE=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/ad.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/handler/ad.py b/handler/ad.py index 5180276..bb92861 100644 --- a/handler/ad.py +++ b/handler/ad.py @@ -56,16 +56,18 @@ class Ad(Resource): if not id: if companyid: sel_sql = f"select id,name,begin_time,end_time,ad_num,ad_title,ad_body,ad_image,jump_param,ad_sort," \ - f"status,companyid,locationid,gameid,channelid,jump_status from ad where companyid={companyid};" + f"status,companyid,locationid,gameid,channelid,jump_status from ad where in_used=1 and " \ + f"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," \ - f"status,companyid,locationid,gameid,channelid,jump_status from ad where status={status};" + f"status,companyid,locationid,gameid,channelid,jump_status from ad where in_used=1 and \ + status={status};" else: sel_sql = f"select id,name,begin_time,end_time,ad_num,ad_title,ad_body,ad_image,jump_param,ad_sort," \ - f"status,companyid,locationid,gameid,channelid,jump_status from ad ;" + f"status,companyid,locationid,gameid,channelid,jump_status from ad where in_used=1 ;" else: sel_sql = f"select id,name,begin_time,end_time,ad_num,ad_title,ad_body,ad_image,jump_param,ad_sort," \ - f"status,companyid,locationid,gameid,channelid,jump_status from ad where id={id};" + f"status,companyid,locationid,gameid,channelid,jump_status from ad where in_used=1 and id={id};" data = self.mydb.query(sel_sql) log.info(f"sql={sel_sql},data={data}") if data: