Showing
4 changed files
with
4 additions
and
20 deletions
@@ -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 | }); |
@@ -764,7 +764,7 @@ let chat = { | @@ -764,7 +764,7 @@ let chat = { | ||
764 | return $.Deferred().resolve(false); // eslint-disable-line | 764 | return $.Deferred().resolve(false); // eslint-disable-line |
765 | } | 765 | } |
766 | 766 | ||
767 | - return api.msghistory(encryptedUid, msgHistory.endTime) | 767 | + return api.fetchHistory(msgHistory.endTime) |
768 | .done(function(result) { | 768 | .done(function(result) { |
769 | if (!result || result.code !== 200 || !result.data) { | 769 | if (!result || result.code !== 200 || !result.data) { |
770 | return false; | 770 | 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); |
-
Please register or login to post a comment