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) => { @@ -87,20 +87,6 @@ exports.fetchHistory = (req, res) => {
87 }); 87 });
88 }; 88 };
89 89
90 -  
91 -exports.msghistory = (req, res) => {  
92 - let uid = req.user.uid;  
93 -  
94 - if (!uid) {  
95 - uid = req.query.uid;  
96 - }  
97 -  
98 -  
99 - imApi.fetchImHistory(uid).then(result => {  
100 - res.json(result);  
101 - });  
102 -};  
103 -  
104 /** 90 /**
105 * Request: 发表留言 91 * Request: 发表留言
106 * type: POST 92 * type: POST
@@ -39,13 +39,11 @@ exports.saveMessage = (encryptedUid, conversationId, content) => { @@ -39,13 +39,11 @@ exports.saveMessage = (encryptedUid, conversationId, content) => {
39 * @param [int] endTime 39 * @param [int] endTime
40 */ 40 */
41 exports.fetchImHistory = (encryptedUid, endTime, pageSize, startTime) => { 41 exports.fetchImHistory = (encryptedUid, endTime, pageSize, startTime) => {
42 - pageSize = pageSize || 10;  
43 -  
44 let params = { 42 let params = {
45 - pageSize,  
46 encryptedUid 43 encryptedUid
47 }; 44 };
48 45
  46 +
49 _.forEach({startTime, endTime}, (val, key) => { 47 _.forEach({startTime, endTime}, (val, key) => {
50 val && (params[key] = val); 48 val && (params[key] = val);
51 }); 49 });
@@ -760,7 +760,7 @@ let chat = { @@ -760,7 +760,7 @@ let chat = {
760 return $.Deferred().resolve(false); // eslint-disable-line 760 return $.Deferred().resolve(false); // eslint-disable-line
761 } 761 }
762 762
763 - return api.msghistory(encryptedUid, msgHistory.endTime) 763 + return api.fetchHistory(msgHistory.endTime)
764 .done(function(result) { 764 .done(function(result) {
765 if (!result || result.code !== 200 || !result.data) { 765 if (!result || result.code !== 200 || !result.data) {
766 return false; 766 return false;
@@ -67,10 +67,10 @@ let api = { @@ -67,10 +67,10 @@ let api = {
67 }, 67 },
68 68
69 // 获取10条历史记录 69 // 获取10条历史记录
70 - msghistory: function(uid, endTime) { 70 + fetchHistory: function(endTime) {
71 let url = '/service/im/fetchHistory'; 71 let url = '/service/im/fetchHistory';
72 let data = { 72 let data = {
73 - uid 73 + encryptedUid
74 }; 74 };
75 75
76 endTime && (data.endTime = endTime); 76 endTime && (data.endTime = endTime);