添加接口说明文档

This commit is contained in:
pengtao 2019-08-14 10:04:43 +08:00
parent f946d10a27
commit 7c51acce00
3 changed files with 206 additions and 1 deletions

0
Readme
View File

197
Readme.md Normal file
View File

@ -0,0 +1,197 @@
数据展示接口
#### 1、返回可用的数据方法按gameid排查
##### 接口地址
http://154.8.214.202:5015/interface/company
##### 返回格式json
##### 请求方式get
##### 请求示范
http://154.8.214.202:5015/interface/company?status=0
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------ |
| gameid | string | 是 | 查询的游戏ID |
| channelid | string | 否 | 默认为6001微信 |
| | | | |
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ------------ | ------ | ---- | ---------- |
| gamename | string | 是 | 游戏中文名 |
| methods | String | 是 | 方法名 |
| methods_name | String | 是 | 方法显示名 |
##### 返回示例
{
"code": 200,
"message": [
{
"appid": "BKadJbmZ",
"appkey": "undefined",
"contact": "pt",
"id": "1001",
"name": "kings",
"status": 0,
"tel": "1234",
"user": "None"
}
]
}
#### 2、返回方法的字段定义
##### 接口地址
http://154.8.214.202:5015/interface/company
##### 返回格式json
##### 请求方式get
##### 请求示范
http://154.8.214.202:5015/interface/company?status=0
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------------ |
| gameid | string | 是 | 查询的游戏ID |
| methods | string | 是 | 默认为6001微信 |
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ------------ | ------ | ---- | ---------- |
| gamename | string | 是 | 游戏中文名 |
| methods | String | 是 | 方法名 |
| methods_name | String | 是 | 方法显示名 |
##### 返回示例
{
"code": 200,
"message": [
{
"appid": "BKadJbmZ",
"appkey": "undefined",
"contact": "pt",
"id": "1001",
"name": "kings",
"status": 0,
"tel": "1234",
"user": "None"
}
]
}
#### 3、按方法和日期返回某天的数据
##### 接口地址
http://154.8.214.202:5015/interface/company
##### 返回格式json
##### 请求方式get
##### 请求示范
http://154.8.214.202:5015/interface/company?status=0
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| --------- | -------- | ---- | ------------------------------------ |
| gameid | string | 是 | 查询的游戏ID |
| channelid | string | 否 | 查询的平台ID默认为6001 |
| methods | string | 是 | 默认为6001微信 |
| date | datetime | 是 | 查询的报表数据格式为“2019-08-12” |
##### 返回参数说明
| 名称 | 类型 | 必填 | 说明 |
| ------------ | ------ | ---- | ---------- |
| gamename | string | 是 | 游戏中文名 |
| methods | String | 是 | 方法名 |
| methods_name | String | 是 | 方法显示名 |
##### 返回示例
{
"code": 200,
"message": [
{
"appid": "BKadJbmZ",
"appkey": "undefined",
"contact": "pt",
"id": "1001",
"name": "kings",
"status": 0,
"tel": "1234",
"user": "None"
}
]
}
#### 4、按方法和日期返回某段时间的数据
##### 接口地址
http://154.8.214.202:5015/interface/company
##### 返回格式json
##### 请求方式get
##### 请求示范
##### 请求参数说明
| 名称 | 类型 | 必填 | 说明 |
| ------------ | -------- | ---- | ----------------------------------------- |
| gameid | int | 是 | 游戏ID |
| channelid | int | 是 | 渠道ID |
| ad_channelid | string | 否 | 广告上报的关键词 |
| method | string | 是 | 查询数据类型 |
| time_partice | int | 是 | 查询时间颗粒0=1分钟1=5分钟2=1小时 |
| time_begin | datetime | 是 | 开始时间 |
| time_end | datetime | 是 | 结束时间 |
select time,num from user_online where env='prod' and gameid='1013' and time >'2019-08-01 01:00:00' and time <'2019-08-03 01:00:00' limit 10
在influxdb中按关键词筛选需要的数据数据按以下结构返回
{
"errcode": 0,
"errmsg": "",
"message": {
"totoal": 2,
"result": [
{
“2019-08-01 01:00:00”:100,
“2019-08-01 02:00:00”:120, }
]
}
}
如查询提供的是错误的方法名则返回错误代码501
如查询结果为空则返回状态码200内容为空

View File

@ -183,7 +183,7 @@ class AD_data(GetFromTga):
try:
temp = {}
temp['views'], temp['u_views'], temp['ad_type_id'], temp['adv_id_str'], temp['activity_id_str'], \
temp['adv_id_state'] = line
temp['adv_id_state'] = line
temp['ad_type_id'] = int(temp['ad_type_id'])
temp['adv_id_state'] = int(temp['adv_id_state'])
temp['ad_type'] = ad_types[temp.get('ad_type_id')]
@ -359,3 +359,11 @@ class Item_data(GetFromTga):
self.write_tga_files(temp)
except Exception:
log.error(f"write {line} 2 tga failed!", exc_info=True)
class Retain_data(GetFromTga):
def event_retain_1(self):
pass
def event_retain_7(self):
pass