Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ this.body = [
}
];
```

#### 回复空串
```js
this.body = '';
```

#### 转发到客服接口
```js
this.body = {
Expand Down
11 changes: 10 additions & 1 deletion lib/wechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,16 @@ wechat.prototype.middleware = function (handle) {
}
}

replyMessageXml = reply(this.body, formated.ToUserName, formated.FromUserName);
/*
* 假如服务器无法保证在五秒内处理并回复,可以直接回复空串。
* 微信服务器不会对此作任何处理,并且不会发起重试。
*/
if (this.body === '') {
return;
}

var replyMessageXml = reply(this.body, formated.ToUserName, formated.FromUserName);

if (!query.encrypt_type || query.encrypt_type === 'raw') {
this.body = replyMessageXml;
} else {
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"scripts": {
"test": "make test-all"
},
"repository": {
"type": "git",
"url": "https://github.com/node-webot/co-wechat"
},
"keywords": [
"wechat",
"wexin"
Expand Down