Authored by 毕凯

Merge branch 'hotfix/cusServcie-historyMsg' into 'master'

Hotfix/cus servcie history msg



See merge request !480
... ... @@ -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,13 +39,11 @@ 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);
});
... ...
... ... @@ -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);
... ...