调整locationid 对应的区域信息

This commit is contained in:
pengtao 2019-09-12 11:48:49 +08:00
parent d6972e6fa8
commit df39e302a0
2 changed files with 23 additions and 14 deletions

View File

@ -236,7 +236,7 @@ http://154.8.214.202:6015/interface/location?gameid=1001&area=2&type=1&mode=2&x=
| type | int | 是 | 类型1=icon2=banner3=浮窗) |
| mode | int | 是 | 广告单播或轮播模式1=单播2=轮播) |
| gameid | int | 是 | 游戏ID |
| channelid | int | 否 | 渠道ID默认是6001 |
| channelid | int | 是 | 渠道ID |
##### 返回参数说明
@ -268,13 +268,17 @@ http://154.8.214.202:5015/interface/location?area=1&type=1&gameid=1003
| 名称 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------------------------------------------------ |
| area | string | 是 | 区域(第一元素1=首页2=游戏中3=结算页4=关闭第二元素X轴第三元素Y轴其中X,Y取值范围0,15)如1,0,0代表首页左上 |
| area | string | 是 | 区域(支持多值,表明页面位置|
|x|int|是|X轴坐标|
|y|int|是|y轴坐标|
|x_offset|int|是|X坐标偏移量|
|y_offset|int|是|Y坐标偏移量|
| type | int | 是 | 类型1=icon2=banner3=浮窗) |
| mode | int | 是 | 广告单播或轮播模式1=单播2=轮播) |
| id | int | 是 | 位置ID |
| | int | 是 | 状态 0=未审批1=审批通过2=审批未通过默认为1 |
| gameid | int | 是 | 游戏ID |
| channelid | int | 否 | 渠道ID默认是6001 |
| channelid | int | 是 | 渠道ID |
|in_used|int|否|是否使用默认为1|
##### 返回参数说明

View File

@ -87,9 +87,10 @@ class Location(Resource):
location['type'] = self.args['type']
location['mode'] = self.args['mode']
location['gameid'] = self.args['gameid']
location['channelid'] = self.args['channelid'] or 6001
location['channelid'] = self.args['channelid']
location['id'] = self.create_id()
if location['area'] and location['type'] and location['mode'] and location['gameid'] :
if location['area'] and location['type'] and location['mode'] and location['gameid'] and location[
'channelid']:
self.mydb.insert("location", location)
return jsonify({'code': 200})
else:
@ -126,14 +127,18 @@ class Location(Resource):
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:
condition = f"id='{self.args['id']}'"
self.mydb.update("location", location, condition)
return jsonify({'code': 200})
if location['area'] and location['type'] and location['mode'] and location['gameid'] and location[
'channelid']:
sel_sql = f"select area from location where id={self.args['id']};"
data = self.mydb.query(sel_sql)
if data:
condition = f"id='{self.args['id']}'"
self.mydb.update("location", location, condition)
return jsonify({'code': 200})
else:
return jsonify({'code': 404, 'message': f"{self.args['id']} not found in mysql!"})
else:
return jsonify({'code': 404, 'message': f"{self.args['id']} not found in mysql!"})
return jsonify({'code': 500, 'message': f"someting not found in {self.args}!"})
except Exception:
log.error("update values to location mysql failed!", exc_info=True)
return jsonify({'code': 500})