调整locationid 对应的区域信息
This commit is contained in:
parent
64cdadf6a1
commit
ed59f2b031
@ -228,8 +228,11 @@ http://154.8.214.202:5015/interface/location?gameid=1003&area=1,1,1&type=1&mode=
|
|||||||
|
|
||||||
| 名称 | 类型 | 必填 | 说明 |
|
| 名称 | 类型 | 必填 | 说明 |
|
||||||
| --------- | ------ | ---- | ------------------------------------------------------------ |
|
| --------- | ------ | ---- | ------------------------------------------------------------ |
|
||||||
| area | string | 是 | 区域(第一元素:1=首页,2=游戏中,3=结算页,4=关闭,第二元素:X轴第三元素:Y轴,其中X,Y取值范围(0,15))如(1,0,0)代表首页左上 ,第四、五元素代表x,
|
| area | string | 是 | 区域(支持多值,表明页面位置|
|
||||||
y轴偏移量|
|
|x|int|是|X轴坐标|
|
||||||
|
|y|int|是|y轴坐标|
|
||||||
|
|x_offset|int|是|X坐标偏移量|
|
||||||
|
|y_offset|int|是|Y坐标偏移量|
|
||||||
| type | int | 是 | 类型(1=icon,2=banner,3=浮窗) |
|
| type | int | 是 | 类型(1=icon,2=banner,3=浮窗) |
|
||||||
| mode | int | 是 | 广告单播或轮播模式(1=单播,2=轮播) |
|
| mode | int | 是 | 广告单播或轮播模式(1=单播,2=轮播) |
|
||||||
| gameid | int | 是 | 游戏ID |
|
| gameid | int | 是 | 游戏ID |
|
||||||
|
@ -14,6 +14,10 @@ log = logging.getLogger(__name__)
|
|||||||
parser = reqparse.RequestParser()
|
parser = reqparse.RequestParser()
|
||||||
parser.add_argument('id')
|
parser.add_argument('id')
|
||||||
parser.add_argument('area')
|
parser.add_argument('area')
|
||||||
|
parser.add_argument('x')
|
||||||
|
parser.add_argument('y')
|
||||||
|
parser.add_argument('x_offset')
|
||||||
|
parser.add_argument('y_offset')
|
||||||
parser.add_argument('type')
|
parser.add_argument('type')
|
||||||
parser.add_argument('mode')
|
parser.add_argument('mode')
|
||||||
parser.add_argument('in_used')
|
parser.add_argument('in_used')
|
||||||
@ -32,7 +36,23 @@ class Location(Resource):
|
|||||||
log.error("get data from location failed!", exc_info=True)
|
log.error("get data from location failed!", exc_info=True)
|
||||||
return jsonify({"code": 500, "message": "PLS Input gameid!"})
|
return jsonify({"code": 500, "message": "PLS Input gameid!"})
|
||||||
channelid = self.args['channelid'] or 6001
|
channelid = self.args['channelid'] or 6001
|
||||||
sql = f"select gameid,channelid,id,area,type,mode from location where gameid={gameid} and channelid={channelid} and in_used=1;"
|
sql = f"""select
|
||||||
|
gameid,
|
||||||
|
channelid,
|
||||||
|
id,
|
||||||
|
area,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
x_offset,
|
||||||
|
y_offset,
|
||||||
|
type,
|
||||||
|
mode
|
||||||
|
from
|
||||||
|
location
|
||||||
|
where
|
||||||
|
gameid={gameid}
|
||||||
|
AND channelid={channelid}
|
||||||
|
and in_used=1;"""
|
||||||
try:
|
try:
|
||||||
data = self.mydb.query(sql)
|
data = self.mydb.query(sql)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -44,8 +64,9 @@ class Location(Resource):
|
|||||||
for line in data:
|
for line in data:
|
||||||
if line:
|
if line:
|
||||||
localtion = {}
|
localtion = {}
|
||||||
localtion['gameid'], localtion['channelid'], localtion['id'], localtion['area'], localtion['type'], \
|
localtion['gameid'], localtion['channelid'], localtion['id'], localtion['area'], localtion['x'], \
|
||||||
localtion['mode'] = line
|
localtion['y'], localtion['x_offset'], localtion['y_offset'], localtion['type'], localtion[
|
||||||
|
'mode'] = line
|
||||||
all_data.append(localtion)
|
all_data.append(localtion)
|
||||||
del localtion
|
del localtion
|
||||||
return jsonify({'code': 200, 'message': all_data})
|
return jsonify({'code': 200, 'message': all_data})
|
||||||
@ -55,13 +76,13 @@ class Location(Resource):
|
|||||||
|
|
||||||
|
|
||||||
def post(self):
|
def post(self):
|
||||||
"""
|
|
||||||
More Actions名称类型必填说明areastring是区域(第一元素:1=首页,2=游戏中,3=结算页,4=关闭,第二元素:X轴第三元素:Y轴,其中X,Y取值范围(0,15))如(1,0,0)代表首页左上typeint是类型(1=icon,2=banner,3=浮窗)modeint是广告单播或轮播模式(1=单播,2=轮播)gameidint是游戏IDchannelidint否渠道ID,默认是6001
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
location = {}
|
location = {}
|
||||||
location['area'] = self.args['area']
|
location['area'] = self.args['area']
|
||||||
|
location['x'] = self.args['x']
|
||||||
|
location['y'] = self.args['y']
|
||||||
|
location['x_offset'] = self.args['x_offset']
|
||||||
|
location['y_offset'] = self.args['y_offset']
|
||||||
location['type'] = self.args['type']
|
location['type'] = self.args['type']
|
||||||
location['mode'] = self.args['mode']
|
location['mode'] = self.args['mode']
|
||||||
location['gameid'] = self.args['gameid']
|
location['gameid'] = self.args['gameid']
|
||||||
@ -69,12 +90,12 @@ class Location(Resource):
|
|||||||
location['id'] = self.create_id()
|
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'] :
|
||||||
self.mydb.insert("location", location)
|
self.mydb.insert("location", location)
|
||||||
|
return jsonify({'code': 200})
|
||||||
else:
|
else:
|
||||||
return jsonify({'code': 500,"message":f"get args was area={location['area']},type={self.args['type']},mode={self.args['mode']},gameid={self.args['gameid']}"})
|
return jsonify({'code': 500,"message":f"get args was area={location['area']},type={self.args['type']},mode={self.args['mode']},gameid={self.args['gameid']}"})
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error("set values to location mysql failed!", exc_info=True)
|
log.error("set values to location mysql failed!", exc_info=True)
|
||||||
return jsonify({'code': 500})
|
return jsonify({'code': 500})
|
||||||
return jsonify({'code': 200})
|
|
||||||
|
|
||||||
|
|
||||||
def create_id(self):
|
def create_id(self):
|
||||||
@ -95,6 +116,10 @@ class Location(Resource):
|
|||||||
location = {}
|
location = {}
|
||||||
location['id'] = self.args['id']
|
location['id'] = self.args['id']
|
||||||
location['area'] = self.args['area']
|
location['area'] = self.args['area']
|
||||||
|
location['x'] = self.args['x']
|
||||||
|
location['y'] = self.args['y']
|
||||||
|
location['x_offset'] = self.args['x_offset']
|
||||||
|
location['y_offset'] = self.args['y_offset']
|
||||||
location['type'] = self.args['type']
|
location['type'] = self.args['type']
|
||||||
location['mode'] = self.args['mode']
|
location['mode'] = self.args['mode']
|
||||||
location['gameid'] = self.args['gameid']
|
location['gameid'] = self.args['gameid']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user