Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持设备消息响应. #176

Closed
wants to merge 5 commits into from
Closed

Conversation

wxhuang
Copy link
Contributor

@wxhuang wxhuang commented May 28, 2015

可以响应设备的文本消息 http://iot.weixin.qq.com/document-2_1.html
响应绑定/解绑事件 http://iot.weixin.qq.com/document-2_2.html
响应WIFI设备状态查询 http://iot.weixin.qq.com/document-2_10.html
响应社交功能 http://iot.weixin.qq.com/document-2_8.html

@coveralls
Copy link

Coverage Status

Coverage increased (+0.34%) to 92.38% when pulling d0e5719 on wxhuang:master into e907f15 on node-webot:master.

@@ -18,6 +18,7 @@ var checkSignature = function (query, token) {
shasum.update(arr.join(''));

return shasum.digest('hex') === signature;
//return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删了。

@JacksonTian
Copy link
Member

最近忙,忘记review了。

@JacksonTian
Copy link
Member

有更新吗

var info = {};
var type = 'text';
info.content = content || '';
if (Array.isArray(content)) {
if (message && (message.MsgType === 'device_text' || message.MsgType === 'device_event')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还有这里,message和content不能统一起来吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不是很明白你的意思.message是直接从微信请求那里传进去的,content是服务器回复内容,请问需要统一成什么样子?不过把fromUsername和toUsername整到message里面还是可以的.

@wxhuang
Copy link
Contributor Author

wxhuang commented Jun 3, 2015

第一次提PR,还在研究怎么整.是PUSH代码然后继续提PR吗?

@JacksonTian
Copy link
Member

你继续push代码就可以了

@coveralls
Copy link

Coverage Status

Coverage increased (+0.34%) to 92.38% when pulling da6f79e on wxhuang:master into e907f15 on node-webot:master.

@JacksonTian
Copy link
Member

没删完吧

@coveralls
Copy link

Coverage Status

Coverage increased (+0.36%) to 92.4% when pulling cbb251d on wxhuang:master into e907f15 on node-webot:master.

delete info.content;
info.DeviceStatus = isNaN(content) ? 0 : content;
} else {
info.content = new Buffer(content).toString('base64');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里 你能确认用户传进来的是个字符串吗?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Buffer(1324124121) 这样就完蛋了。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Buffer(String(content)).toString('base64');
这样,确保它是个字符串。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好恐怖,刚才试了一下差点把机器搞崩了= =,多谢指点.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.36%) to 92.4% when pulling 358e30a on wxhuang:master into e907f15 on node-webot:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.36%) to 92.4% when pulling 44fadc3 on wxhuang:master into e907f15 on node-webot:master.

@ibigbug
Copy link

ibigbug commented Jun 3, 2015

👍

@JacksonTian
Copy link
Member

Land in ac4afac.

@JacksonTian JacksonTian closed this Jun 3, 2015
@JacksonTian
Copy link
Member

你需要另外发个PR,来更新下文档。描述下该怎么用。

@JacksonTian
Copy link
Member

更新完 我们发2.0.0版本。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants