From 008affeb50583f237b9e8d82e8a0be8ced1562b5 Mon Sep 17 00:00:00 2001 From: kf_wuhao <15392746632@qq.com> Date: Wed, 31 Mar 2021 14:51:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cbd21fe..6944a89 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,99 @@ -# pointapi -打点上报接口 \ No newline at end of file +##### 简要描述 + +- 打点上报接口 + +##### 请求URL +- ` http://taapi.legu.cc/v1/point/ ` +##### 请求方式 +- POST + +##### 参数 + +| 参数名 | 必选 | 类型 | 说明 | +| :---------- | :--- | :----- | -------------------------------------------------- | +| distinct_id | 是 | string | 账户id | +| game | 是 | string | 游戏代号 | +| account_id | 是 | string | 访客id | +| act | 是 | string | ta sdk方法(track,user_set,user_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; + } + } + +``` \ No newline at end of file