-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
支持设备消息响应. #176
Conversation
@@ -18,6 +18,7 @@ var checkSignature = function (query, token) { | |||
shasum.update(arr.join('')); | |||
|
|||
return shasum.digest('hex') === signature; | |||
//return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删了。
最近忙,忘记review了。 |
有更新吗 |
var info = {}; | ||
var type = 'text'; | ||
info.content = content || ''; | ||
if (Array.isArray(content)) { | ||
if (message && (message.MsgType === 'device_text' || message.MsgType === 'device_event')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还有这里,message和content不能统一起来吗
There was a problem hiding this comment.
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里面还是可以的.
第一次提PR,还在研究怎么整.是PUSH代码然后继续提PR吗? |
你继续push代码就可以了 |
没删完吧 |
delete info.content; | ||
info.DeviceStatus = isNaN(content) ? 0 : content; | ||
} else { | ||
info.content = new Buffer(content).toString('base64'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里 你能确认用户传进来的是个字符串吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Buffer(1324124121) 这样就完蛋了。
There was a problem hiding this comment.
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');
这样,确保它是个字符串。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好恐怖,刚才试了一下差点把机器搞崩了= =,多谢指点.
👍 |
Land in ac4afac. |
你需要另外发个PR,来更新下文档。描述下该怎么用。 |
更新完 我们发2.0.0版本。 |
可以响应设备的文本消息 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