tsghost/doc/api.md
2021-08-06 15:01:09 +08:00

69 lines
1.7 KiB
Markdown

## 一. 说明
所有接口均需上传sessionid
通用返回JSON结构, 接口Response的数据结构说明只包含data部分
``` JSON
{
"errcode": 0, //0:成功 2: 缺少必要参数(accountid, sessionid) 4: 帐号被封, 5: 帐号未找到 100: 所有未定义的错误
"errmsg": "", //错误描述
"data": {}, // 数据
}
```
## 二. 客户端接口列表
### 1. 上报消息订阅状态
1. Method: POST
2. URI: /api/svr/:accountid/update_subscribe
3. HOST: https://ghost.kingsome.cn
> 说明: 该接口有2个作用
> 1: 给wx.requestSubscribeMessage获取到的用户同意的模板id增加发送次数
> 2: 更新某模板id的lastCheck时间, 目的是告诉服务端, 相关记录当天不需要再发送了
| 字段 | 说明 |
| -------- | -------------------------------------- |
| accountid | 帐号id|
> POST参数
| 字段 | 说明 |
| -------- | -------------------------------------- |
| templateids | 模板id列表或者模板类型(jsub_xxx)列表 |
| counts | 1或0组成的数组, 须和templateids数量一致, 1: 表示增加一次发送机会, 0: 只更新lastCheck的时间 |
3. Response: JSON
```js
{}
```
### 2. 发送订阅消息
1. Method: POST
2. URI: /api/svr/:accountid/send_subscribe_msg
3. HOST: https://ghost.kingsome.cn
| 字段 | 说明 |
| -------- | -------------------------------------- |
| accountid | 帐号id|
> POST参数
| 字段 | 说明 |
| -------- | -------------------------------------- |
| type | 消息的类型(jsub_xxx) |
3. Response: JSON
```js
{
msgid: '发送成功后, 微信返回的消息id'
}
```