Authored by 李奇

历史消息修正

... ... @@ -87,20 +87,6 @@ exports.fetchHistory = (req, res) => {
});
};
exports.msghistory = (req, res) => {
let uid = req.user.uid;
if (!uid) {
uid = req.query.uid;
}
imApi.fetchImHistory(uid).then(result => {
res.json(result);
});
};
/**
* Request: 发表留言
* type: POST
... ...
... ... @@ -39,18 +39,16 @@ exports.saveMessage = (encryptedUid, conversationId, content) => {
* @param [int] endTime
*/
exports.fetchImHistory = (encryptedUid, endTime, pageSize, startTime) => {
pageSize = pageSize || 10;
let params = {
pageSize,
encryptedUid
};
_.forEach({startTime, endTime}, (val, key) => {
val && (params[key] = val);
});
return ImService.post('/api/conversationMessage/pageList', params)
return ImService.post('/api/conversationMessage/pageList', params, {timeout: 5000})
.then(result => {
return result;
}, () => {
... ...
... ... @@ -760,7 +760,7 @@ let chat = {
return $.Deferred().resolve(false); // eslint-disable-line
}
return api.msghistory(encryptedUid, msgHistory.endTime)
return api.fetchHistory(msgHistory.endTime)
.done(function(result) {
if (!result || result.code !== 200 || !result.data) {
return false;
... ...
... ... @@ -67,10 +67,10 @@ let api = {
},
// 获取10条历史记录
msghistory: function(uid, endTime) {
fetchHistory: function(endTime) {
let url = '/service/im/fetchHistory';
let data = {
uid
encryptedUid
};
endTime && (data.endTime = endTime);
... ...