调整接口上传内容

This commit is contained in:
pengtao 2019-09-24 14:48:42 +08:00
parent 3b1059c949
commit 8cb3c0016c
2 changed files with 43 additions and 36 deletions

View File

@ -48,22 +48,29 @@ http://spread-test.kingsome.cn/webapp/index.php?c=Ops&a=getAdList&body={"gameid"
"message": { "message": {
"totoal": 1, "totoal": 1,
"result": [ "result": [
{ {
"ad_body": "33", "ad_body": "",
"ad_image": "https://resource.kingsome.cn//ad/1d7bb7a2-a865-11e9-8df4-525400ddcafb_banner12(1).png", "ad_image": "https://resource.kingsome.cn/ad/b63dd2ca-dad5-11e9-9ea2-525400ddcafb_png",
"ad_sort": "0", "ad_property": "{\"is_shake\":0,\"is_hot\":0,\"is_new\":0,\"is_recommend\":0,\"appid\":\"wxdb103a128e118619\",\"jump_param\":\"yx2nyabgm8\",\"played\":0}",
"ad_title": "333", "ad_sort": "0",
"area": "1,0,0", "ad_title": "",
"channelid": "6001", "area": "3,8,12,0,32",
"companyid": "1002", "channelid": "6001",
"id": "1014", "companyid": "0",
"jump_param": "fdfd", "createtime": "2019-09-20 10:42:42",
"jump_status": "0", "id": "1258",
"locationid": "1001", "jump_param": "",
"mode": "0", "jump_status": "1",
"name": "33", "ld_property": "{\"title\":\"底部横向滚动\",\"show_name\":\"\",\"bg_img\":\"\",\"has_dot\":false,\"is_shake\":false,\"is_hide\":true,\"is_show_name\":false,\"related\":[],\"scale\":1}",
"type": "1" "locationid": "1073",
} "mode": "1",
"name": "首页icon轮播+底部横向滚动6",
"type": "6",
"x": "8",
"x_offset": "0",
"y": "12",
"y_offset": "32"
},
] ]
} }
} }
@ -140,8 +147,10 @@ https://spread-test.kingsome.cn/webapp/index.php?c=Ops&a=upJumpRecording
| c | string | 是 | OPS通用接口标志 | | c | string | 是 | OPS通用接口标志 |
| a | string | 是 | 方法定义 upJumpRecording | | a | string | 是 | 方法定义 upJumpRecording |
| gameid | int | 是 | 游戏ID | | gameid | int | 是 | 游戏ID |
| channelid | int | 是 | 平台ID | | locationid | int | 是 | 广告位置ID |
| body | string | 是 | 广告属性json (area,locationid,ad_channel,appid) | | uid | int | 是 | 用户ID或微信openid |
| ad_channel | int | 是 | 广告特征码 见上ad_property.jump_param |
| aid | int | 是 | 广告ID |
##### 返回参数说明 ##### 返回参数说明

View File

@ -44,15 +44,18 @@ class DispatchHandler(tornado.web.RequestHandler):
self._selfupJumpRecording() self._selfupJumpRecording()
def _selfupJumpRecording(self): def _selfupJumpRecording(self):
# {"area":"2,0,5,0,0","locationId":"1011","ad_channel":"wxxssss","appid":"sss"} """| gameid | int | 是 | 游戏ID |
| locationid | int | | 广告位置ID |
| uid | int | | 用户ID或微信openid |
| ad_channel | int | | 广告特征码 见上ad_property.jump_param |
| aid | int | | 广告ID |
"""
try: try:
body = unquote(self.get_query_argument('body'), 'utf-8')
gameid = self.get_query_argument('gameid') gameid = self.get_query_argument('gameid')
channelid = self.get_query_argument('channelid') locationid = self.get_query_argument('locationid')
area = json.loads(body)['area'] uid = self.get_query_argument('uid')
locationid = json.loads(body)['locationid'] ad_channel = self.get_query_argument('ad_channel')
ad_channel = json.loads(body)['ad_channel'] aid = self.get_query_argument('aid')
appid = json.loads(body)['appid']
except Exception as e: except Exception as e:
result = {'errcode': 2, "errmsg": f"get args failed,{str(e)}"} result = {'errcode': 2, "errmsg": f"get args failed,{str(e)}"}
@ -76,25 +79,20 @@ class DispatchHandler(tornado.web.RequestHandler):
self.event_type = "jump_recording" self.event_type = "jump_recording"
try: try:
tga_data = {} tga_data = {}
tga_data['ad_channel'] = channelid
tga_data['account_id'] = gameid
tga_data['gameid'] = channelid
tga_data['date'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
tga_data['area'] = area
tga_data['locationid'] = locationid
tga_data['ad_channel'] = ad_channel tga_data['ad_channel'] = ad_channel
tga_data['appid'] = appid tga_data['account_id'] = uid
tga_data['gameid'] = gameid
tga_data['date'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
tga_data['locationid'] = locationid
tga_data['aid'] = aid
self.tga.put_event_data(tga_data, f'rep_{self.event_type}') self.tga.put_event_data(tga_data, f'rep_{self.event_type}')
return self.write({'errcode': 0, "errmsg": '', "message": ""}) return self.write({'errcode': 0, "errmsg": '', "message": ""})
except Exception: except Exception:
log.error(f"write 2 tga failed!,context={body}", exc_info=True) log.error(f"write 2 tga failed!", exc_info=True)
return self.write_error(2) return self.write_error(2)
def _selfGetLocation(self): def _selfGetLocation(self):
try: try:
input = json.loads(self.get_query_argument('body')) input = json.loads(self.get_query_argument('body'))