|
@ -36,7 +36,7 @@ exports.getChatList = function (userId, handler) {
|
|
|
* @param userId
|
|
|
* @param handler
|
|
|
*/
|
|
|
exports.getChatAllUnReadCount = function (userId, handler) {
|
|
|
exports.getChatAllUnReadCount = function (userId, handler) {
|
|
|
imRepo.execQuery({
|
|
|
"sql": "SELECT new_msg_count from msg_statistic WHERE uid=? AND new_msg_count>0",
|
|
|
"args": [userId],
|
|
@ -50,6 +50,7 @@ exports.updatePrivateChatSummary = function (userId, peerId, from, type, content
|
|
|
if (userId == from) {
|
|
|
//userId = from ,peerId = to from = from
|
|
|
// 更新自身的统计信息
|
|
|
|
|
|
var sql = "INSERT INTO msg_statistic (uid,uuid,from_uid,peer_uid,msg_type,last_content_type,last_content,new_msg_count) " +
|
|
|
"VALUES (?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE peer_uid=?,last_content_type=?,last_content=?";
|
|
|
|
|
@ -59,15 +60,29 @@ exports.updatePrivateChatSummary = function (userId, peerId, from, type, content
|
|
|
"handler": handler
|
|
|
});
|
|
|
} else {
|
|
|
var sql ="";
|
|
|
if(type==7){//结束的咨询
|
|
|
//userId = to ,peerId = from, from = from
|
|
|
sql = "INSERT INTO msg_statistic (uid,uuid,from_uid,peer_uid,msg_type,last_content_type,last_content) " +
|
|
|
"VALUES (?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE peer_uid=?,last_content_type=?,last_content=?";
|
|
|
// 更新对端的统计信息
|
|
|
imRepo.execQuery({
|
|
|
"sql": sql,
|
|
|
"args": [userId, uuid, from, peerId, 1, type, content, peerId, type, content],
|
|
|
"handler": handler
|
|
|
});
|
|
|
}else{
|
|
|
//userId = to ,peerId = from, from = from
|
|
|
var sql = "INSERT INTO msg_statistic (uid,uuid,from_uid,peer_uid,msg_type,last_content_type,last_content,new_msg_count) " +
|
|
|
sql = "INSERT INTO msg_statistic (uid,uuid,from_uid,peer_uid,msg_type,last_content_type,last_content,new_msg_count) " +
|
|
|
"VALUES (?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE peer_uid=?,last_content_type=?,last_content=?,new_msg_count=new_msg_count+1";
|
|
|
// 更新对端的统计信息
|
|
|
imRepo.execQuery({
|
|
|
"sql": sql,
|
|
|
"args": [userId, uuid, from, peerId, 1, type, content, 1, peerId, type, content],
|
|
|
"handler": handler
|
|
|
});
|
|
|
// 更新对端的统计信息
|
|
|
imRepo.execQuery({
|
|
|
"sql": sql,
|
|
|
"args": [userId, uuid, from, peerId, 1, type, content, 1, peerId, type, content],
|
|
|
"handler": handler
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
};
|
|
|
|