Skip to content

Commit

Permalink
时间戳格式兼容.
Browse files Browse the repository at this point in the history
  • Loading branch information
wxhuang committed Jun 3, 2015
1 parent da6f79e commit cbb251d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/wechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ var reply = function (content, fromUsername, toUsername, message) {
var info = {};
var type = 'text';
info.content = content || '';
info.createTime = new Date().getTime();
if (message && (message.MsgType === 'device_text' || message.MsgType === 'device_event')) {
info.DeviceType = message.DeviceType;
info.DeviceID = message.DeviceID;
info.SessionID = isNaN(message.SessionID) ? 0 : message.SessionID;
info.createTime = parseInt(new Date().getTime() / 1000);

This comment has been minimized.

Copy link
@JacksonTian

JacksonTian Jun 3, 2015

Member

info.createTime = Math.floor(info.createTime / 1000);

if (message['Event'] === 'subscribe_status' || message['Event'] === 'unsubscribe_status') {
delete info.content;
info.DeviceStatus = isNaN(content) ? 0 : content;
Expand All @@ -211,7 +213,6 @@ var reply = function (content, fromUsername, toUsername, message) {
}
}
info.msgType = type;
info.createTime = parseInt(new Date().getTime());
info.toUsername = toUsername;
info.fromUsername = fromUsername;
return compiled(info);
Expand Down

0 comments on commit cbb251d

Please sign in to comment.