Skip to content
Open
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
16 changes: 12 additions & 4 deletions demo/javascript/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ module.exports = {
return;
} else {
brief = this.getBrief(data, type);
// 设置会话历史时间
if(msg.delay){
var historyTime = msg.delay;
}
if (targetNode) {
switch (type) {
case 'txt':
Expand All @@ -446,7 +450,8 @@ module.exports = {
errorText: msg.errorText,
id: msg.id,
status: status,
nid: nid
nid: nid,
time: historyTime || ""
}, this.sentByMe);
break;
case 'emoji':
Expand Down Expand Up @@ -494,7 +499,8 @@ module.exports = {
error: msg.error,
errorText: msg.errorText,
status: status,
nid: nid
nid: nid,
time: historyTime || ""
}, this.sentByMe);
}
break;
Expand Down Expand Up @@ -530,7 +536,8 @@ module.exports = {
length: msg.length,
id: msg.id,
error: msg.error,
errorText: msg.errorText
errorText: msg.errorText,
time: historyTime || ""
}, this.sentByMe);
}
break;
Expand Down Expand Up @@ -570,7 +577,8 @@ module.exports = {
error: msg.error,
errorText: msg.errorText,
status: status,
nid: nid
nid: nid,
time: historyTime || ""
};
if (msg.ext) {
option.fileSize = msg.ext.fileSize;
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -3202,6 +3202,8 @@ connection.prototype.addToLocal = function (message, type, status) {
}
msg.msgType = type;
msg.msgStatus = status;
// 保存当前发送信息时间到localStorage
msg.delay = message.delay || new Date().toLocaleString();
var oldRecord = window.localStorage.getItem(this.user);
var serializedChatRecord = JSON.stringify(msg);
if (oldRecord && (oldRecord.indexOf(message.id) >= 0
Expand Down