接口说明 - 0.0.1
# 链加加
## 📝修改记录 - CHANGELOG
- **2020-08-11**
- 修改 `获取签到信息` 接口增加签到状态字段,移除是否签到字段
- **2020-08-10**
- 【重要】用户信息增加 `id` 字段
- **2020-08-07**
- 增加分页泛型接口
- 修改获取我的评论、获取积分收益列表、获取邀请好友列表、和我的收藏接口为分页响应对象
- **2020-08-06**
- 消息列表消息增加时间
- 增加退出登录接口
- **2020-08-05**
- 更新修改用户信息接口调用成功返回用户信息
- **2020-08-01**
- 同步 `User` 实体和获取用户信息接口返回一致
- **2020-07-30**
- 【重要】增加修改记录
- 【重要】修改了获取快讯列表接口,增加查询参数 `date`
- 【重要】删除用户登录验证相关不需要的接口
- 【重要】修改了注册接口逻辑,注册成功只需要提示注册成功与否
- 修改了登录,发送验证码接口,增加了 `country` 区号参数
- 修改了登录接口增加 `source` 来源参数
- 完成获取评论接口
- 完成分享记录接口
## Todo
1:登录注册背景图较大
2:签到需要给出已签到状态
## 后台接口
- [https://docs.apipost.cn/view/e104e9380a0c1bc6 - 胡方兵](https://docs.apipost.cn/view/e104e9380a0c1bc6)
- [https://docs.apipost.cn/view/a4b69bdb44251ce8 - 刘添](https://docs.apipost.cn/view/a4b69bdb44251ce8)
- [https://docs.apipost.cn/view/6333131333d2d194#2566065 - 行情](https://docs.apipost.cn/view/6333131333d2d194#2566065)
## 设计图分析
- `Method` 请求方法
- `Path` 访问路径
- `Params` 请求参数
- `Header` 头部参数
- `Query` `GET` 请求参数
- `Params` `url` 参数
- `Body` `POST` 、`PUT`、`DELETE` 请求参数
- `Success` 响应对象
- `${path}` 后台自定义路径
### 基础约定
- **时间统一为时间戳**
- **传输字段原子化**
- **不需要的字段不返回,减少风险,减少流量,增加可读性**
- **对于POST类请求,动作完成需要返回受影响的对象。例如新增的对象,修改的对象**
- **应该使用连字符”-“来提高URL的可读性,而不是使用下划线”_”或者“驼峰式”**
- **URL路径中首选小写字母**
- **URL路径名词均为复数**
### 基础请求格式
```typescript
// Params
const params = {
// Header
header: {
// Token
token?: string,
// 语种
langCode: '',
},
}
```
### 基础响应格式
```typescript
interface ResponseRO {
// 接口是否请求成功
success: boolean
// 调用状态说明
message: string
// 状态码
statusCode: number
// 响应数据体
obj?: object
// 错误体
errors?: Array<string>
}
// 分页响应格式
interface PaginationResponseRO extends ResponseRO {
// 响应数据体
obj: {
// 记录
records: Array<T>,
// 总条数
total: number,
}
}
```
### 标签说明
🟢 以确定接口,可以直接开发。
🟡 需要讨论,可能会有修改。需要前后端讨论。
⚪ 待确认,后端暂不开发。
🔴 以删除。
## 📂 实体
可以用来参考设计数据库
### 用户 - User
```typescript
type User = {
// 昵称
nickName: string,
// 用户签名
sign: string,
// 头像图片url
avatar: string,
// 积分
credit: number,
// 邀请码
inviteCode: string,
// 邀请人数
inviteNumber: number,
// 是否打开了签到提醒
isOpenSignRemind: boolean,
// 是否打开了消息通知
isOpenNoticeRemind: boolean,
// 是否设置了密码
// isSetPassword: boolean,
// 评论获赞次数
commentLikeNumber: number,
}
```
### 资讯 - News
```typescript
// 文章图片
type Image = {
// id
id: string,
// 图片链接
imgUrl: string,
}
// 资讯
type News = {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 头像
avatar: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 分享人数
share: number,
// 文章图片
images: array<Image>,
// 文章内容富文本
content: string,
// 看涨人数
long: number,
// 看跌人数
short: number,
}
```
### 快讯 - NewsFlash
```typescript
type NewsFlash = {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 文章内容富文本
content: string,
// 看涨人数
long: number,
// 看跌人数
short: number,
}
```
### 行情 - Market
```typescript
// 行情
type Market = {
// id
id: string,
// 币种符号
symbol: string,
// 币种中文名
name: string,
// 市值(Capitalization)
cap: string,
// 行情价格
price: string,
// 涨跌幅,正表示涨,负表示跌
change: number,
}
```
### 交易所 - Exchange
```typescript
// 交易所
type Exchange = {
// id
id: string,
// 交易所图标
icon: string,
// 交易所名字
name: string,
// 24小时成交量
volume: string,
// 支持的交易模式
modes: array<string>,
}
```
## 📂 通用模块
### 🟢 图片上传
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/upload'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 上传的文件
file: file
},
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// Url
url: string
},
}
```
## 📂 个人中心 - user
### 🔴 ~~手机号码直接登录~~
前端:需要使用极验无感验证
- 需要实践下极验无感验证,参数可能有更改
- 暂时不确定参数
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/auth/phone/login'
// Params
const params = {
// Body
data: {
// 手机号码
phone: string
},
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// Token
token: string
},
}
```
### 🟢 手机号码密码登录
- 需要对手机号正则校验
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/auth/phone/login'
enum Source {
h5 = 'H5',
app = 'App',
}
// Params
const params = {
// Body
data: {
// 手机号码
phone: string,
// 区号:类似+86
country: string,
// 密码
password: string,
// 来源
source: enum<Source>,
},
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// Token
token: string
},
}
```
### 🟢 退出登录 `2020-08-06 新增`
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/auth/log-out'
// Params
const params = {
// Header
header: {
// Token
token: string
},
}
```
### 🟢 手机号码注册
- 需要对手机号正则校验
- 返回注册成功与否即可
- ~~注册完成直接登录返回token~~
~~前端:注册完成跳转首页~~
前端:注册完成跳转登录页
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/auth/phone/register'
// Params
const params = {
// Body
data: {
// 手机号码
phone: sring,
// 验证码
captcha: string,
// 邀请码
invite: string,
// 密码
password: string,
},
}
```
### 🟢 手机号码注册发送验证码
- 需要对手机号正则校验
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/auth/phone/register/captcha'
// Params
const params = {
// Query
params: {
// 手机号码
phone: string,
// 区号:类似+86
country: string,
},
}
```
### 🔴 ~~绑定手机发送验证码~~
用于微信或者 qq 登录,第一次登录无手机号码需要绑定
- 不确定
- 需要对手机号正则校验
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/auth/phone/bind/captcha'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params: {
// 手机号码
phone: string
},
}
```
### 🔴 ~~绑定手机号码~~
- 不确定
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/auth/phone/bind'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 手机号码
phone: string
},
}
```
### 🟡 获取用户信息
- 调用比较频繁的接口,用来获取用户的属性
- 字段可能会有增加
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user'
// Params
const params = {
// Header
header: {
// Token
token: string
},
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// 用户信息
userInfo: {
// 用户id
id: string,
// 昵称
nickName: string,
// 用户签名
sign: string,
// 头像图片url
avatar: string,
// 积分
credit: number,
// 邀请码
inviteCode: string,
// 邀请人数
inviteNumber: number,
// 是否打开了签到提醒
isOpenSignRemind: boolean,
// 是否打开了消息通知
isOpenNoticeRemind: boolean,
// 是否设置了密码
// isSetPassword: boolean,
// 评论获赞次数
commentLikeNumber: number,
}
},
}
```
### 🟢 修改用户信息
- 签名字段限制30个字以内
- 空密码账号设置密码需要校验是否为空账号
- 修改完成返回用户信息
```typescript
// Method
const method = 'PUT'
// Path
const path = '${path}/user'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 头像图片url
avatar?: string,
// 昵称
nickName?: string,
// 用户签名
sign?: string,
// 签到提醒
remindSign?: boolean,
// 消息通知
remindNotice?: boolean,
// 设置新的密码
password?: string,
}
}
```
### 🟢 修改用户密码
```typescript
// Method
const method = 'PUT'
// Path
const path = '${path}/user/password'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 老密码
password: string,
// 新密码
newPassword: string,
}
}
```
### 🟢 获取邀请好友列表
- 时间分页
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/invites'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// 邀请的用户
type InviteUser {
// ID
id: string,
// 头像图片url
avatar: string,
// 昵称
nickName: string,
// 奖励积分
credit: number,
// 邀请时间
inviteDate: timestamp,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// 记录
records: Array<InviteUser>,
// 总数
total: number,
},,
}
```
### 🟢 获取签到信息
- 以周为单位
奖励信息字段
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/sign'
// Params
const params = {
// Header
header: {
// Token
token: string
},
}
// 签到信息
type Sign = {
// id
id: string,
// 星期几
day: number[1-7],
// 是否已经签到
// signed: boolean,
// 签到状态
status: number,
}
// 奖励信息
type Award = {
// id
id: string,
// 第几天
days: number[3, 5, 7],
// 签到状态
status: number,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// 签到信息
sign: array<Sign>,
// 奖励信息
award: array<Award>,
},
}
```
### 🟢 周签到
- 后台处理签到的时间
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/user/sign/weekend'
// Params
const params = {
// Header
header: {
// Token
token: string,
},
}
```
### 🟢 领取签到奖励
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/sign/award'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 奖励id
id: string,
}
}
```
### 🟢 领取邀请好友积分
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/user/sign/invite'
// Params
const params = {
// Header
header: {
// Token
token: string
},
}
```
### 🟢 获取积分收益列表
- 后端确定下名称是否要用到数据字典
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/credits/income'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// 收入
type Income {
// ID
id: string,
// 名称
name: string,
// 日期时间
date: timestamp,
// 奖励积分
credit: number,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// 记录
records: Array<Income>,
// 总数
total: number,
},,
}
```
### 🟢 获取我的评论
- 时间分页
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/comments'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// 评论
type Comment = {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复数量
reply: number,
// 评论的资讯
news: {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 头像
avatar: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 分享人数
share: number,
// 文章图片
images: array<Image>,
},
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// 记录
records: Array<Comment>,
// 总数
total: number,
},
}
```
### 🟢 获取我的收藏
- 时间分页
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/favorites'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// 文章图片
type Image = {
// id
id: string,
// 图片链接
imgUrl: string,
}
// 资讯
type News = {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 头像
avatar: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 分享人数
share: number,
// 是否收藏
favorite: boolean,
// 标题图片
images: array<Image>,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// 记录
records: Array<News>,
// 总数
total: number,
},
}
```
### 🟢 收藏文章
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/favorite'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data:{
// 文章id
id: string,
},
}
```
### 🟢 取消收藏文章
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/news/favorite'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data:{
// 文章id
id: string,
},
}
```
### 🟢 获取系统消息列表
- 时间分页
- 最新的在最前面
- 兼容富文本显示
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/notices/system'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// 系统消息
type Notice {
// ID
id: string,
// 内容
content: string,
// 时间
created: timestamp,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: Array<Notice>,
}
```
### 🟢 获取@我的消息列表
- 时间分页
- 最新的在最前面
- 兼容富文本显示
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/notices/at'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// @消息
type Notice {
// ID
id: string,
// 内容
content: string,
// 时间
created: timestamp,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: Array<Notice>,
}
```
### 🟢 获取点赞消息列表
- 时间分页
- 最新的在最前面
- 兼容富文本显示
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/user/notices/like'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// 点赞消息
type Notice {
// ID
id: string,
// 内容
content: string,
// 时间
created: timestamp,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: Array<Notice>,
}
```
### 🟢 获取提交分类列表
- 不分页
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/feedback/classify'
// Params
const params = {
// Header
header: {
// Token
token: string
},
}
// 分类
type Classify {
// ID
id: string,
// 名称
name: string,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: Array<Classify>,
}
```
### 🟢 提交意见反馈
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/feedback'
type Image {
// 图片地址
url: string,
}
// Params
const params = {
// Header
header: {
// Token
token: string
},
data: {
// 分类ID
classifyId: string,
// 内容
content: string,
// 图片
images: Array<Image>,
// 联系方式
contact: string,
},
}
```
## 📂 资讯 - news
### 🟢 获取首页 banner 图
- 范围限定3-6张
- 类型可以为文章或者外部链接
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news/banners'
// 类型
enum BannerType {
Post = 'post',
Url = 'url'
}
type Banner = {
// id
id: string,
// 图片链接
imgUrl: string,
// 类型
type: enum<BannerType>,
// 地址
url: string | null,
// 文章id
postId: string | null,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<Banner>,
}
```
### 🟡 获取首页资讯
- 需要确定首页资讯显示样式
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news'
// Params
const params = {
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
},
}
// 文章图片
type Image = {
// id
id: string,
// 图片链接
imgUrl: string,
}
// 资讯
type News = {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 头像
avatar: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 分享人数
share: number,
// 文章图片
images: array<Image>,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<News>,
}
```
### 🟢 获取热门搜索关键词
- 最大8个
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news/search/keywords'
type Keyword = {
// id
id: string,
// 关键词
keyword: string,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<Keyword>,
}
```
### 🟢 资讯搜索
需要讨论下价格怎么传?
- 有 token 显示是否收藏,无 token 默认未收藏
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news/search'
// 搜索类型
enum searchType {
// 资讯
News = 'news',
// 交易所
Exchange = 'exchange',
// 行情
Market = 'market',
}
// 法币类型
enum CurrencyType {
cny = 'CNY',
usd = 'USD'
}
// Params
const params = {
// Header
header: {
// Token
token?: string
},
// Query
params: {
// 关键词
keyword: string,
// 类型
type: enum<searchType> | null,
// 法币类型
currency: enum<CurrencyType>,
},
}
// 文章图片
type Image = {
// id
id: string,
// 图片链接
imgUrl: string,
}
// 资讯
type News = {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 头像
avatar: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 分享人数
share: number,
// 文章图片
images: array<Image>,
}
// 交易所
type Exchange = {
// id
id: string,
// 交易所图标
icon: string,
// 交易所名字
name: string,
// 24小时成交量
volume: string,
// 支持的交易模式
modes: array<string>,
}
// 行情
type Market = {
// id
id: string,
// 币种符号
symbol: string,
// 币种中文名
name: string,
// 市值(Capitalization)
cap: string,
// 行情价格
price: string,
// 涨跌幅,正表示涨,负表示跌
change: number,
// 是否收藏
favorite: boolean,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// 资讯
news: array<News>,
// 交易所
exchanges: array<Exchange>,
// 行情
markets: array<Market>,
},
}
```
### 🟢 获取文章详情
- 有 token 显示是否收藏,无 token 默认无收藏按钮,看涨,看跌逻辑相同
- 没有下一篇文章返回 `null`
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news/${id}'
// Params
const params = {
// Header
header: {
// Token
token?: string
},
}
// 文章图片
type Image = {
// id
id: string,
// 图片链接
imgUrl: string,
}
// 资讯
type News = {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 头像
avatar: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 分享人数
share: number,
// 文章图片
images: array<Image>,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 作者头像
avatar: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 文章图片
images: array<Image>,
// 文章内容富文本
content: string,
// 看涨人数
long: number,
// 看跌人数
short: number,
// 是否看涨
isLong: boolean,
// 是否看空
isShort: boolean,
// 是否收藏
isFavorite: boolean,
// 下一篇文章
next: object<News>
},
}
```
### 🟢 文章看涨
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/long'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 文章id
id: string,
}
}
```
### 🟢 文章取消看涨
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/news/long'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 文章id
id: string,
}
}
```
### 🟢 文章看空
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/short'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 文章id
id: string,
}
}
```
### 🟢 文章取消看空
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/news/short'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 文章id
id: string,
}
}
```
### 🟢 获取文章评论
- 有 token 显示是否点赞,无 token 显示未点赞
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news/comments'
// Params
const params = {
// Header
header: {
// Token
token?: string
},
// Query
params: {
// 文章id
id: string,
// 数量
size: number,
// 创建时间
created: timestamp,
}
}
type Comment = {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复数量
reply: number
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<Comment>,
}
```
### 🟢 获取评论回复
- 有 token 显示是否点赞,无 token 显示未点赞
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news/comments/reply'
// Params
const params = {
// Header
header: {
// Token
token?: string
},
// Query
params: {
// 评论id
id: string,
// 数量
size: number,
// 创建时间
created: timestamp,
}
}
type ReplyComment = {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复谁,艾特显示的用户名
replyUserNickName: string | null,
// 回复的用户id
replyUserId: string | null,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<ReplyComment>,
}
```
### 🟢 评论点赞
- 需要返回更新后的评论
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/comments/like'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 评论id
id: string,
}
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复谁,艾特显示的用户名
replyUserNickName: string | null,
// 回复的用户id
replyUserId: string | null,
},
}
```
### 🟢 评论取消点赞
- 需要返回更新后的评论
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/news/comments/like'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 评论id
id: string,
}
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复谁,艾特显示的用户名
replyUserNickName: string | null,
// 回复的用户id
replyUserId: string | null,
},
}
```
### 🟢 回复点赞
- 需要返回更新后的回复
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/comments/reply/like'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 回复id
id: string,
}
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复谁,艾特显示的用户名
replyUserNickName: string | null,
// 回复的用户id
replyUserId: string | null,
},
}
```
### 🟢 回复取消点赞
- 需要返回更新后的回复
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/news/comments/reply/like'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 回复id
id: string,
}
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复谁,艾特显示的用户名
replyUserNickName: string | null,
// 回复的用户id
replyUserId: string | null,
},
}
```
### 🟢 评论文章
- 返回添加的评论
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/comments'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 文章id
id: string,
// 评论内容
content: string,
}
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复数量
reply: number
},
}
```
### 🟢 回复评论
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/comments/reply'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 回复id
replyId: string,
// 评论id
commentId: string,
// 回复内容
content: string,
}
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: {
// id
id: string,
// 用户id
userId: string,
// 头像 url
avatar: string,
// 用户昵称
nickName: string,
// 评论内容
content: string,
// 发表时间
publish: timestamp,
// 点赞数量
like: number,
// 是否已点赞
isLike: boolean,
// 回复谁,艾特显示的用户名
replyUserNickName: string | null,
// 回复的用户id
replyUserId: string | null,
},
}
```
### 🟡 资讯分享记录
- 不确定未登录用户是否能分享
- 用来记录文章分享次数
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news/share'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 资讯id
id: string,
}
}
```
## 📂 快讯 - news-flash
### 🟡 获取快讯列表
- 有 token 显示是否看涨或看空,无 token 不显示个人影响
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/news-flash'
// Params
const params = {
// Header
header: {
// Token
token?: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
// 日期:例如 2020-12-31
date: string,
},
}
type NewsFlash = {
// id
id: string,
// 文章标题
title: string,
// 文章作者
author: string,
// 发表日期
date: timestamp,
// 来源
source: string,
// 文章内容富文本
content: string,
// 看涨人数
long: number,
// 看跌人数
short: number,
// 是否看涨
isLong: boolean,
// 是否看跌
isShort: boolean,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<NewsFlash>,
}
```
### 🟢 快讯看涨
- 无法同时看涨或看空
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news-flash/long'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 快讯id
id: string,
}
}
```
### 🟢 快讯取消看涨
- 无法同时看涨或看空
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/news-flash/long'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 快讯id
id: string,
}
}
```
### 🟢 快讯看空
- 无法同时看涨或看空
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/news-flash/short'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 快讯id
id: string,
}
}
```
### 🟢 快讯取消看空
- 无法同时看涨或看空
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/news-flash/short'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data: {
// 快讯id
id: string,
}
}
```
## 📂 行情 - market
### 🟡 获取行情列表
- 有 `token` 显示是否收藏,无 `token` 显示未收藏
- 查询参数的 `favorite` 前提必须要 `token`
- 带了 `favorite` 为查询收藏的行情
- 获取自选行情优先按照设置的排序,没有设置按照添加时间排序,后添加的在最上面
- 排序可能需要前端处理
- 市值可能没有字段
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/market'
// 法币类型
enum CurrencyType {
cny = 'CNY',
usd = 'USD'
}
// 排序
enum Sort {
// 价格
price = 'Price',
// 涨跌幅
change = 'Change',
}
// 排序方式
enum SortType {
asc = 'ASC',
desc = 'DESC',
}
// Params
const params = {
// Header
header: {
// Token
token?: string
},
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
// 法币类型
currency: enum<CurrencyType>,
// 排序字段
sort: enum<Sort> | null,
// 排序方式
sortType: enum<SortType> | null,
// 是否收藏
favorite: boolean,
},
}
// 行情
type Market = {
// id
id: string,
// 币种符号
symbol: string,
// 币种中文名
name: string,
// 市值(Capitalization)
cap: string,
// 行情价格
price: string,
// 涨跌幅,正表示涨,负表示跌
change: number,
// 是否收藏
favorite: boolean,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<Market>,
}
```
### 🟢 收藏行情
```typescript
// Method
const method = 'POST'
// Path
const path = '${path}/market/favorite'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data:{
// 行情id
id: string,
},
}
```
### 🟢 取消收藏行情
```typescript
// Method
const method = 'DELETE'
// Path
const path = '${path}/market/favorite'
// Params
const params = {
// Header
header: {
// Token
token: string
},
// Body
data:{
// 行情id
id: string,
},
}
```
### 🟢 获取推荐行情列表
- 同行情列表,`favorite` 字段为 `false`
### 🟡 获取交易所列表
- 24小时成交量可能拿不到
- icon可能拿不到
```typescript
// Method
const method = 'GET'
// Path
const path = '${path}/market/exchange'
// 法币类型
enum CurrencyType {
cny = 'CNY',
usd = 'USD'
}
// 排序
enum Sort {
// 24小时成交量
volume = 'Volume',
}
// 排序方式
enum SortType {
asc = 'ASC',
desc = 'DESC',
}
// Params
const params = {
// Query
params:{
// 数量
size: number,
// 创建时间
created: timestamp,
// 法币类型
currency: enum<CurrencyType>,
// 排序字段
sort: enum<Sort> | null,
// 排序方式
sortType: enum<SortType> | null,
},
}
// 交易所
type Exchange = {
// id
id: string,
// 交易所图标
icon: string,
// 交易所名字
name: string,
// 24小时成交量
volume: string,
// 支持的交易模式
modes: array<string>,
}
// Success
const res = {
// 操作是否成功
success: boolean,
// 提示
msg: string
// 响应体
obj: array<Exchange>,
}
```
### 🟢 获取自选行情列表
- 同获取行情列表,`favorite` 字段为 `true`
### 🟡 自选排序保存
- 需要讨论下传参?
- 前端实现需要实践
```typescript
// Method
const method = 'PUT'
// Path
const path = '${path}/market/favorite'
// 行情排序
type MarketSort = {
// 行情币种id
id: string,
// 排序
order: number,
}
// Params
const params = {
// Body
data: {
sort: array<MarketSort>
},
}
```