Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Mar 21, 2024
1 parent e8e3805 commit db7300f
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 85 deletions.
84 changes: 81 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,89 @@
# 雷索纳斯市场 / resonance-market

[![resonance-market](https://img.shields.io/endpoint?url=https://pages.onekuma.cn/project/resonance-market&label=在线访问)](https://resonance.breadio.wiki/)
[![resonance-market](https://img.shields.io/endpoint?url=https://pages.onekuma.cn/project/naria2&label=在线访问)](https://resonance.breadio.wiki/)
[![CI](https://github.com/yjl9903/resonance-market/actions/workflows/ci.yml/badge.svg)](https://github.com/yjl9903/resonance-market/actions/workflows/ci.yml)

## 数据上报接口文档
## API 接口

[此处](./report.md)
### 单次上传

`https://resonance.breadio.wiki/api/log` 这一 endpoint 上, 接受 POST 请求,请求体为 JSON 格式的对象, 包含以下字段:

```ts
{
"name": ProductName,
"sourceCity": CityName,
"targetCity": CityName,
"type": "buy" | "sell",
"trend": "up" | "same" | "down",
"price": number,
"percent": number,
"uploadedAt": number
}
```

其中 `ProductName` 为商品名称, `CityName` 为城市名称, 可在 [全商品表格](./scripts/全商品统计.csv) 中查看

`price` 为价格(整数), `percent` 为价格显示百分比(例如 `112`, 而非 `1.2`), `uploadedAt` 为上传 UNIX 时间戳, 单位为毫秒

以下为一个示例

```JSON
{
"name": "防弹背心",
"percent": 110,
"price": 3225,
"sourceCity": "铁盟哨站",
"targetCity": "修格里城",
"trend": "up",
"type": "sell",
"uploadedAt": 1710595468922
}
```

#### 响应

预期响应为 `200 OK`, 响应体为

```JSON
{
"count": 1
}
```

### 批量上报

`https://resonance.breadio.wiki/api/logs` 这一 endpoint 上, 接受 POST 请求,请求体为 JSON 格式的列表, 列表中每一个对象与单次上传的格式相同:

```ts
[
{
"name": ProductName,
"sourceCity": CityName,
"targetCity": CityName,
"type": "buy" | "sell",
"trend": "up" | "same" | "down",
"price": number,
"percent": number,
"uploadedAt": number
},
// ...
]
```

各字段含义与单次上传相同

#### 响应

预期响应为 `200 OK`, 响应体为

```ts
{
"count": number
}
```

其中 `count` 为成功上传的数据条数

## 本地运行 或 开发测试 / Run locally or Development Test

Expand Down
82 changes: 0 additions & 82 deletions report.md

This file was deleted.

0 comments on commit db7300f

Please sign in to comment.