方法字段接口添加是否需要排序字段(默认为0)

This commit is contained in:
pengtao 2019-08-16 14:45:35 +08:00
parent 6e76875505
commit 43df9a16f7
2 changed files with 16 additions and 13 deletions

View File

@ -38,25 +38,25 @@ http://154.8.214.202:5022/webapp/index.php?c=Ops&a=getmethods&gameid=2001
| methods | String | 是 | 方法名 | | methods | String | 是 | 方法名 |
| methods_name | String | 是 | 方法显示名 | | methods_name | String | 是 | 方法显示名 |
| result | json | 是 | 方法明细字段名称及显示名 | | result | json | 是 | 方法明细字段名称及显示名 |
|need_sort|int|是|作为排序的字段|
{ {
"errcode": 0, "errcode": 0,
"errmsg": "", "errmsg": "",
"result": [ "result": [
{ {
"methods": "tap_2001", "methods": "stage",
"fields": "name", "method_display": "关卡通关记录",
"comment": "点击按钮名称" "need_sort": 0,
},
{
"methods": "tap_2001",
"fields": "num", "fields": "num",
"comment": "次数" "comment": "通关次数"
}, },
{ {
"methods": "tap_2001", "methods": "stage",
"fields": "dis_num", "method_display": "关卡通关记录",
"comment": "人数" "need_sort": 0,
"fields": "level",
"comment": "关卡数"
} }
] ]
} }

View File

@ -2,7 +2,7 @@
# pip install apscheduler # pip install apscheduler
# python data_collect_interface.py --port=5021 # python data_collect_interface.py --port=5021
# 广告数据接口 # 广告数据接口
# 请求方式为 http://154.8.214.202:5020/webapp/index.php?c=Ops&a=gamereport1004&body={"times":"2019-07-22","is_new":0} # 请求方式为 http://154.8.214.202:5022/webapp/index.php?c=Ops&a=gamereport1004&body={"times":"2019-07-22","is_new":0}
import tornado.ioloop import tornado.ioloop
import tornado.httpserver import tornado.httpserver
@ -50,7 +50,8 @@ class DispatchHandler(tornado.web.RequestHandler):
a.method_display, a.method_display,
a.need_sort, a.need_sort,
b.fields, b.fields,
b.comment b.comment,
b.sort_num
FROM FROM
(SELECT (SELECT
method_name, method_name,
@ -65,6 +66,7 @@ class DispatchHandler(tornado.web.RequestHandler):
(SELECT (SELECT
method_name, method_name,
fields, fields,
sort_num,
comment comment
FROM FROM
methods_detail )b methods_detail )b
@ -76,7 +78,8 @@ class DispatchHandler(tornado.web.RequestHandler):
for line in data: for line in data:
temp = {} temp = {}
try: try:
temp['methods'], temp['method_display'],temp['need_sort'],temp['fields'], temp['comment'] = line temp['methods'], temp['method_display'],temp['need_sort'],temp['fields'], temp['comment'],\
temp['sort_num'] = line
output.append(temp) output.append(temp)
except Exception: except Exception:
log.error(f"split {line} error, get data from methods!", exc_info=True) log.error(f"split {line} error, get data from methods!", exc_info=True)