修改广告GET方法,添加按状态返回和按广告ID返回明细的功能
This commit is contained in:
parent
8eefeb6bcd
commit
f7630ad262
37
README.MD
37
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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}!'
|
||||
})
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user