This commit is contained in:
kf_wuhao 2021-03-31 14:51:56 +08:00
parent bc88719107
commit 008affeb50

100
README.md
View File

@ -1,3 +1,99 @@
# pointapi
打点上报接口 ##### 简要描述
- 打点上报接口
##### 请求URL
- ` http://taapi.legu.cc/v1/point/ `
##### 请求方式
- POST
##### 参数
| 参数名 | 必选 | 类型 | 说明 |
| :---------- | :--- | :----- | -------------------------------------------------- |
| distinct_id | 是 | string | 账户id |
| game | 是 | string | 游戏代号 |
| account_id | 是 | string | 访客id |
| act | 是 | string | ta sdk方法trackuser_setuser_setOnce等 |
| event_name | 否 | string | 事件名 当act为track时 此参数必须 |
| properties | 是 | 字典 | 属性 |
| ts | 是 | int | 时间戳 |
| sign | 是 | string | 签名 md5(distinct_id+account_id+act+ts+"0r4X00mH") |
##### 请求示例
```shell
curl -X 'POST' \
'http://taapi.legu.cc/v1/point/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"distinct_id":"aaa",
"account_id":"bb",
"game":"test",
"act":"track",
"event_name":"ceshi",
"properties":{
"lv":6,
"vip":7,
"#device_id":"aaaa",
"herostate": [["fffgsa", 2, 3, 4, 5], ["ddd", 4, 5, 6, 8]]
},
"sign":"b0991b9928fd17bd43b4092677f05088",
"ts":1617096477
}'
```
##### 返回示例
```
{
"code": 0,
"msg": "ok"
}
```
#### 项目结构
![image-20210331142642641](assets/image-20210331142642641.png)
#### 项目部署
服务器 139.159.159.3
正式项目 /data/legu/pointapi
测试项目 /data/legu/ponitapi_test
#### 测试部署
supervisord 配置
/etc/supervisord.d/taapi.ini
```shell
[program:taapi_test]
command=pipenv run gunicorn main:app -b 0.0.0.0:6666 -w 16 -k uvicorn.workers.UvicornWorker
directory=/data/legu/ponitapi_test
autostart=true
startsecs=5
autorestart=true
timeout=200
stopasgroup=true
killasgroup=true
redirect_stderr=true
stdout_logfile_maxbytes=20MB
stdout_logfile_backups=20
stdout_logfile=/data/legu/ponitapi_test/log.log
```
nginx 配置
/etc/nginx/conf.d/taapi.legu.cc.conf
```shell
server {
listen 80;
server_name taapi.legu.cc;
location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:6666;
}
}
```