[v9-final] 修复imgFlag/message列名/chatroom列名/标签统计
This commit is contained in:
@@ -143,7 +143,7 @@ rpc.exports = {
|
||||
limit = parseInt(limit) || 100;
|
||||
offset = parseInt(offset) || 0;
|
||||
return execSQL(db,
|
||||
"SELECT username, alias, conRemark, nickName, type, contactLabelIds, imgFlag " +
|
||||
"SELECT username, alias, conRemark, nickname, type, contactLabelIds " +
|
||||
"FROM rcontact WHERE type=3 ORDER BY rowid LIMIT " + limit + " OFFSET " + offset
|
||||
);
|
||||
},
|
||||
@@ -171,7 +171,7 @@ rpc.exports = {
|
||||
return execSQL(db,
|
||||
"SELECT username, alias, conRemark, nickName, type FROM rcontact " +
|
||||
"WHERE (nickName LIKE '%" + keyword + "%' OR conRemark LIKE '%" + keyword + "%' OR alias LIKE '%" + keyword + "%') " +
|
||||
"AND type IN (3,4) LIMIT 50"
|
||||
"AND type NOT IN (0,4) LIMIT 50"
|
||||
);
|
||||
},
|
||||
|
||||
@@ -208,6 +208,7 @@ rpc.exports = {
|
||||
if (!db) return {error: 'main DB not available'};
|
||||
var friends = execSQL(db, "SELECT COUNT(*) as n FROM rcontact WHERE type=3");
|
||||
var groups = execSQL(db, "SELECT COUNT(*) as n FROM chatroom");
|
||||
var labels = execSQL(db, "SELECT COUNT(*) as n FROM ContactLabel");
|
||||
var msgs = execSQL(db, "SELECT COUNT(*) as n FROM message");
|
||||
var imgs = execSQL(db, "SELECT COUNT(*) as n FROM ImgInfo2");
|
||||
var videos = execSQL(db, "SELECT COUNT(*) as n FROM videoinfo2");
|
||||
@@ -220,7 +221,7 @@ rpc.exports = {
|
||||
images: imgs.rows[0] ? parseInt(imgs.rows[0].n) : 0,
|
||||
videos: videos.rows[0] ? parseInt(videos.rows[0].n) : 0,
|
||||
files: files.rows[0] ? parseInt(files.rows[0].n) : 0,
|
||||
labels: labels.rows[0] ? parseInt(labels.rows[0].n) : 0,
|
||||
labels: labels.rows[0] ? parseInt(labels.rows[0].n) : 0
|
||||
};
|
||||
},
|
||||
|
||||
@@ -252,8 +253,8 @@ rpc.exports = {
|
||||
type = parseInt(type) || 1;
|
||||
var msgId = Date.now();
|
||||
var createTime = Date.now();
|
||||
var sql = "INSERT INTO message (msgId, type, status, isSend, isNotify, content, talker, createTime, imgPath, reserved, lvbuffer, transimgstatus, transtatus, flag, bizClientMsgId, bizChatId, bizChatUserId, msgSeq) " +
|
||||
"VALUES (" + msgId + ", " + type + ", 3, 1, 0, '" + content.replace(/'/g, "''") + "', '" + toUser + "', " + createTime + ", '', 0, NULL, 0, 0, 0, '', 0, '', 0)";
|
||||
var sql = "INSERT INTO message (msgId, type, status, isSend, isNotify, content, talker, createTime, imgPath, reserved, lvbuffer, transContent, flag, bizClientMsgId, bizChatId, bizChatUserId, msgSeq, historyId) " +
|
||||
"VALUES (" + msgId + ", " + type + ", 3, 1, 0, '" + content.replace(/'/g, "''") + "', '" + toUser + "', " + createTime + ", '', 0, NULL, '', 0, '', 0, '', 0, 0)";
|
||||
var r = writeSQL(db, sql);
|
||||
if (r.success) {
|
||||
var verify = execSQL(db, "SELECT msgId, content, talker, createTime FROM message WHERE msgId=" + msgId);
|
||||
@@ -271,8 +272,8 @@ rpc.exports = {
|
||||
(targets || []).forEach(function(toUser) {
|
||||
var msgId = Date.now() + Math.floor(Math.random() * 10000);
|
||||
var createTime = Date.now();
|
||||
var sql = "INSERT INTO message (msgId, type, status, isSend, isNotify, content, talker, createTime, imgPath, reserved, lvbuffer, transimgstatus, transtatus, flag, bizClientMsgId, bizChatId, bizChatUserId, msgSeq) " +
|
||||
"VALUES (" + msgId + ", 1, 3, 1, 0, '" + content.replace(/'/g, "''") + "', '" + toUser + "', " + createTime + ", '', 0, NULL, 0, 0, 0, '', 0, '', 0)";
|
||||
var sql = "INSERT INTO message (msgId, type, status, isSend, isNotify, content, talker, createTime, imgPath, reserved, lvbuffer, transContent, flag, bizClientMsgId, bizChatId, bizChatUserId, msgSeq, historyId) " +
|
||||
"VALUES (" + msgId + ", 1, 3, 1, 0, '" + content.replace(/'/g, "''") + "', '" + toUser + "', " + createTime + ", '', 0, NULL, '', 0, '', 0, '', 0, 0)";
|
||||
var r = writeSQL(db, sql);
|
||||
if (r.success) { successCount++; results.push({toUser: toUser, msgId: msgId, success: true}); }
|
||||
else { results.push({toUser: toUser, success: false, error: r.error}); }
|
||||
@@ -313,14 +314,14 @@ rpc.exports = {
|
||||
getGroupMembers: function(chatroomId) {
|
||||
var db = getDB('main');
|
||||
if (!db) return {error: 'main DB not available'};
|
||||
var group = execSQL(db, "SELECT memberlist, roomowner, announcement, selfDisplayName FROM chatroom WHERE chatroomname='" + chatroomId + "'");
|
||||
var group = execSQL(db, "SELECT memberlist, roomowner, chatroomnotice, selfDisplayName FROM chatroom WHERE chatroomname='" + chatroomId + "'");
|
||||
if (!group.rows[0]) return {error: 'Group not found', rows: [], count: 0};
|
||||
var g = group.rows[0];
|
||||
var members = (g.memberlist || '').split(';').filter(function(m) { return m.trim(); });
|
||||
return {
|
||||
chatroomId: chatroomId,
|
||||
owner: g.roomowner,
|
||||
announcement: g.announcement,
|
||||
announcement: g.chatroomnotice,
|
||||
selfDisplayName: g.selfDisplayName,
|
||||
memberCount: members.length,
|
||||
members: members.slice(0, 100),
|
||||
@@ -332,7 +333,7 @@ rpc.exports = {
|
||||
setGroupAnnouncement: function(chatroomId, announcement) {
|
||||
var db = getDB('main');
|
||||
if (!db) return {error: 'main DB not available'};
|
||||
var sql = "UPDATE chatroom SET announcement='" + announcement.replace(/'/g, "''") + "' WHERE chatroomname='" + chatroomId + "'";
|
||||
var sql = "UPDATE chatroom SET chatroomnotice='" + announcement.replace(/'/g, "''") + "' WHERE chatroomname='" + chatroomId + "'";
|
||||
return writeSQL(db, sql);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user