调整位置服务接口

This commit is contained in:
pengtao 2019-07-24 19:43:13 +08:00
parent 3ba71f7216
commit a6ec54f42f
3 changed files with 21 additions and 217 deletions

220
README.MD
View File

@ -196,12 +196,13 @@ http://154.8.214.202:5015/interface/location
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| --------- | ---- | ---- | --------------------------------------------- |
| gameid | int | 是 | 游戏ID |
| channelid | int | 是 | 渠道ID默认是6001 |
| area | int | 否 | 游戏区域 (1=首页2=游戏中3=结算页4=关闭) |
| | int | 否 | 类型1=icon2=banner3=浮窗) |
| 名称 | 类型 | 必填 | 说明 |
| ----------- | ---- | ---- | --------------------------------------------- |
| gameid | int | 是 | 游戏ID |
| channelid | int | 是 | 渠道ID默认是6001 |
| area | int | 是 | 游戏区域 (1=首页2=游戏中3=结算页4=关闭) |
| type | int | 是 | 类型1=icon2=banner3=浮窗4=icon2 |
| localtionid | int | 是 | 位置ID |
##### 返回参数说明
@ -560,210 +561,3 @@ http://154.8.214.202:5015/interface/area
"code": 200
}
#### 14、变更区域
##### 接口地址
http://154.8.214.202:5015/interface/area
##### 返回格式json
##### 请求方式put
##### 请求示范
http://154.8.214.202:5015/interface/area
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | --------------------------------------------------- |
| gameid | int | 是 | 游戏ID |
| channelid | int | 是 | 渠道ID默认为6001 |
| areaid | int | 是 | 区域ID |
| areaname | string | 是 | 区域说明 |
| status | int | 否 | 默认为0未审批1=审批通过2=审批未通过3=暂停 |
| | string | 是 | 区域示意图 |
#####
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------- |
| code | int | 是 | 返回状态 |
##### 返回示例
{
"code": 200
}
#### 15、查询区域
##### 接口地址
http://154.8.214.202:5015/interface/area
##### 返回格式json
##### 请求方式get
##### 请求示范
http://154.8.214.202:5015/interface/area
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| --------- | ---- | ---- | ----------------- |
| gameid | int | 是 | 游戏ID |
| channelid | int | 否 | 渠道ID 默认为6001 |
返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------- |
| code | int | 是 | 返回状态 |
##### 返回示例
{
"code": 200
}
#### 16、新建类型
##### 接口地址
http://154.8.214.202:5015/interface/type
##### 返回格式json
##### 请求方式post
##### 请求示范
http://154.8.214.202:5015/interface/type
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | --------------------------------------------------- |
| gameid | int | 是 | 游戏ID |
| channelid | int | 否 | 渠道ID默认为6001 |
| typeid | int | 是 | 类型ID |
| typename | string | 是 | 类型描述文字 |
| status | int | 否 | 默认为0未审批1=审批通过2=审批未通过3=暂停 |
| url | string | 是 | 类型示例图 |
#####
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------- |
| code | int | 是 | 返回状态 |
##### 返回示例
{
"code": 200
}
#### 17、删除按钮类型
##### 接口地址
http://154.8.214.202:5015/interface/type
##### 返回格式json
##### 请求方式delete
##### 请求示范
http://154.8.214.202:5015/interface/type
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------------- |
| id | int | 是 | 需删除的位置ID |
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------- |
| code | int | 是 | 返回状态 |
##### 返回示例
{
"code": 200
}
#### 18、变更按钮类型
##### 接口地址
http://154.8.214.202:5015/interface/type
##### 返回格式json
##### 请求方式put
##### 请求示范
http://154.8.214.202:5015/interface/type
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------------- |
| id | int | 是 | 需删除的位置ID |
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------- |
| code | int | 是 | 返回状态 |
##### 返回示例
{
"code": 200
}
#### 19、查询按钮类型
##### 接口地址
http://154.8.214.202:5015/interface/type
##### 返回格式json
##### 请求方式get
##### 请求示范
http://154.8.214.202:5015/interface/type
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| --------- | ---- | ---- | ----------------- |
| gameid | int | 是 | 游戏ID |
| channelid | int | 否 | 渠道ID 默认为6001 |
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ---- | ---- | ---- | -------- |
| code | int | 是 | 返回状态 |
##### 返回示例
{
"code": 200
}

View File

@ -16,7 +16,8 @@ parser.add_argument('id')
parser.add_argument('area')
parser.add_argument('type')
parser.add_argument('in_used')
parser.add_argument('gameid')
parser.add_argument('channelid')
class Location(Resource):
def __init__(self):
@ -25,7 +26,10 @@ class Location(Resource):
def get(self):
sql = f"select id,area,type from location where in_used=1;"
gameid = self.args['gameid']
channelid = self.args['channelid'] or 6001
sql = f"select gameid,channelid,id,area,type from location where gameid={gameid} and channelid={channelid} " \
f"and in_used=1;"
try:
data = self.mydb.query(sql)
except Exception:
@ -37,7 +41,8 @@ class Location(Resource):
for line in data:
if line:
localtion = {}
localtion['id'], localtion['area'], localtion['type'] = line
localtion['gameid'], localtion['channelid'], localtion['id'], localtion['area'], localtion[
'type'] = line
all_data.append(localtion)
del localtion
return jsonify({'code': 200, 'message': all_data})
@ -51,6 +56,8 @@ class Location(Resource):
location = {}
location['area'] = self.args['area']
location['type'] = self.args['type']
location['gameid'] = self.args['gameid']
location['channelid'] = self.args['channelid'] or 6001
location['id'] = self.create_id()
self.mydb.insert("location", location)
except Exception:
@ -78,7 +85,9 @@ class Location(Resource):
location['id'] = self.args['id']
location['area'] = self.args['area']
location['type'] = self.args['type']
location['in_used'] = self.args['in_used'] or 0
location['gameid'] = self.args['gameid']
location['channelid'] = self.args['channelid']
location['in_used'] = self.args['in_used'] or 1
sel_sql = f"select area from location where id={self.args['id']};"
data = self.mydb.query(sel_sql)
if data:

View File

@ -24,5 +24,6 @@ api.add_resource(Location, '/interface/location')
api.add_resource(Ad, '/interface/ad')
api.add_resource(Cos_sdk, '/interface/cos_upload')
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True, port=5015)