From f7630ad2629f0eec9b9dce4555262b8cd0fd67db Mon Sep 17 00:00:00 2001 From: pengtao Date: Thu, 11 Jul 2019 10:20:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=BF=E5=91=8AGET?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=8C=89=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E8=BF=94=E5=9B=9E=E5=92=8C=E6=8C=89=E5=B9=BF=E5=91=8A?= =?UTF-8?q?ID=E8=BF=94=E5=9B=9E=E6=98=8E=E7=BB=86=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 37 +++++++++++++++++++++++++++++++++++-- handler/ad.py | 4 ++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index 246f609..9868810 100644 --- a/README.MD +++ b/README.MD @@ -420,12 +420,15 @@ http://192.168.100.20:8888/ad ##### 请求示范 -http://192.168.100.20:8888/ad?gameid=1003&locationid=1 +http://192.168.100.20:8888/ad?id=1002 + +http://192.168.100.20:8888/ad?status=0 ##### 请求参数说明 | 名称 | 类型 | 必填 | 说明 | | ------ | ---- | ---- | --------------------------- | +| | int | 否 | 广告ID,其优先级高于status | | status | int | 否 | 审批状态,默认为1(已审批) | ##### 返回参数说明 @@ -437,6 +440,36 @@ http://192.168.100.20:8888/ad?gameid=1003&locationid=1 ##### 返回示例 { - "code": 200 + "code": 200, + "message": { + "ad_body": "hi world", + "ad_image": "http://1", + "ad_num": 300, + "ad_sort": 1, + "ad_title": "hello", + "ad_url": "http://2", + "begin_time": "Sat, 01 Jun 2019 00:00:00 GMT", + "end_time": "Sun, 01 Dec 2019 00:00:00 GMT", + "id": 1002, + "name": "abc", + "status": 0 + } +} + +{ + "code": 200, + "message": { + "ad_body": "hi world", + "ad_image": "http://1", + "ad_num": 300, + "ad_sort": 1, + "ad_title": "hello", + "ad_url": "http://2", + "begin_time": "Sat, 01 Jun 2019 00:00:00 GMT", + "end_time": "Sun, 01 Dec 2019 00:00:00 GMT", + "id": 1002, + "name": "abc", + "status": 0 + } } diff --git a/handler/ad.py b/handler/ad.py index b2923d4..69eaec3 100644 --- a/handler/ad.py +++ b/handler/ad.py @@ -49,7 +49,7 @@ class Ad(Resource): # # log.error(f"请输入必须的游戏ID和位置ID字段,当前获得是{gameid},{localid}") # 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 status: sel_sql = f"select id,name,begin_time,end_time,ad_num,ad_title,ad_body,ad_image,ad_url,ad_sort,status " \ @@ -77,7 +77,7 @@ class Ad(Resource): else: return jsonify({ 'code': 404, - 'message': f'ad not found with gameid={gameid},localid={localid},now={now},status={status}!' + 'message': f'ad not found with id={id},status={status}!' })