From 94b3ef043edea91a254a5767071a4087404bd628 Mon Sep 17 00:00:00 2001 From: pengtao Date: Thu, 11 Jul 2019 10:59:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8C=89companyid=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=B9=BF=E5=91=8A=E5=88=97=E8=A1=A8=E7=9A=84=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/ad.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/handler/ad.py b/handler/ad.py index 304c0b8..df9be90 100644 --- a/handler/ad.py +++ b/handler/ad.py @@ -54,16 +54,16 @@ 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,ad_url,ad_sort," \ - f"status,companyid from ad where companyid={companyid};" + f"status,companyid,locationid,gameid from ad where companyid={companyid};" elif status: sel_sql = f"select id,name,begin_time,end_time,ad_num,ad_title,ad_body,ad_image,ad_url,ad_sort," \ - f"status,companyid from ad where status={status};" + f"status,companyid,locationid,gameid from ad where status={status};" else: sel_sql = f"select id,name,begin_time,end_time,ad_num,ad_title,ad_body,ad_image,ad_url,ad_sort," \ - f"status,companyid from ad ;" + f"status,companyid,locationid,gameid from ad ;" else: sel_sql = f"select id,name,begin_time,end_time,ad_num,ad_title,ad_body,ad_image,ad_url,ad_sort," \ - f"status,companyid from ad where id={id};" + f"status,companyid,locationid,gameid from ad where id={id};" data = mydb.query(sel_sql) log.info(f"sql={sel_sql},data={data}") if data: @@ -72,15 +72,15 @@ class Ad(Resource): try: for line in data: ad_info['id'], ad_info['name'], ad_info['begin_time'], ad_info['end_time'], ad_info['ad_num'], \ - ad_info['ad_title'], ad_info['ad_body'], ad_info['ad_image'], ad_info['ad_url'], ad_info[ - 'ad_sort'], ad_info['status'], ad_info['companyid'] = line + ad_info['ad_title'], ad_info['ad_body'], ad_info['ad_image'], ad_info['ad_url'], ad_info['ad_sort'], \ + ad_info['status'], ad_info['companyid'], ad_info['locationid'], ad_info['gameid'] = line all.append(ad_info) return jsonify({'code': 200, 'message': all}) except Exception: log.error("split data from mysql failed!", exc_info=True) else: return jsonify({ - 'code': 404, 'message': f'ad not found with id={id},status={status}!' + 'code': 404, 'message': f'ad not found with id={id},status={status},companyid={companyid}!' })