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: