pointapi/README.md
2021-04-01 11:30:58 +08:00

100 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

##### 简要描述
- 打点上报接口
##### 请求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;
}
}
```