This commit is contained in:
lightings 2023-07-25 15:55:51 +08:00
parent d0090f5709
commit d5a18c49d5
2 changed files with 3 additions and 2 deletions

View File

@ -51,11 +51,12 @@ class UserDao {
if (limit>20) { if (limit>20) {
throw new Error(`limit too large: ${limit}`); throw new Error(`limit too large: ${limit}`);
} }
const query = `SELECT idx, account_id, CAST(name as CHAR) as name FROM t_user WHERE idx>? AND (CAST(account_id as CHAR) = ? OR CAST(name as CHAR) LIKE ?) LIMIT ?`; const query = `SELECT idx, account_id, CAST(name as CHAR) as name FROM t_user WHERE idx>? AND (CAST(account_id as CHAR) = ? OR CAST(name as CHAR) LIKE ?) AND account_id != ? LIMIT ?`;
const results = await query_game(query, [ const results = await query_game(query, [
last_idx, last_idx,
name, name,
"%" + name + "%", "%" + name + "%",
uid,
limit, limit,
]); ]);

View File

@ -88,7 +88,7 @@ stick.onBody((msgId, data) => {
msg = await rpc("chat.chatHandler.worldChat", { content: "hello" }); msg = await rpc("chat.chatHandler.worldChat", { content: "hello" });
console.log(msg); console.log(msg);
msg = await rpc("friend.friendHandler.findUser", { name: "Xiao", last_idx: 0, limit: 5 }); msg = await rpc("friend.friendHandler.findUser", { name: "Xiao", last_idx: 0, limit: 5 });
console.log(msg); console.log(JSON.stringify(msg, null, 2));
msg = await rpc("guild.guildHandler.createGuild", { guildName: "newGuild1", logo: "test001"}); msg = await rpc("guild.guildHandler.createGuild", { guildName: "newGuild1", logo: "test001"});
console.log(msg); console.log(msg);