Commit 96826a5f authored by Chunchi Che's avatar Chunchi Che

fix

parent 423c93c0
Pipeline #19963 passed with stages
in 5 minutes and 44 seconds
...@@ -83,9 +83,10 @@ export default async function (action: sqliteAction): Promise<sqliteResult> { ...@@ -83,9 +83,10 @@ export default async function (action: sqliteAction): Promise<sqliteResult> {
const ftsMetas: CardMeta[] = []; const ftsMetas: CardMeta[] = [];
const textStmt = YGODB.prepare( const textStmt = YGODB.prepare(
"SELECT * FROM texts WHERE name LIKE '%$query%'" "SELECT * FROM texts WHERE name LIKE $query"
); );
textStmt.bind({ $query: query }); textStmt.bind({ $query: `%${query}%` });
while (textStmt.step()) { while (textStmt.step()) {
const row = textStmt.getAsObject(); const row = textStmt.getAsObject();
ftsTexts.push(row); ftsTexts.push(row);
...@@ -93,7 +94,6 @@ export default async function (action: sqliteAction): Promise<sqliteResult> { ...@@ -93,7 +94,6 @@ export default async function (action: sqliteAction): Promise<sqliteResult> {
for (const text of ftsTexts) { for (const text of ftsTexts) {
const id = text.id; const id = text.id;
if (id) { if (id) {
const dataStmt = YGODB.prepare( const dataStmt = YGODB.prepare(
"SELECT * FROM datas WHERE ID = $id" "SELECT * FROM datas WHERE ID = $id"
......
...@@ -40,22 +40,26 @@ export default function WaitRoom() { ...@@ -40,22 +40,26 @@ export default function WaitRoom() {
useEffect(() => { useEffect(() => {
if (ip && player && player.length != 0 && passWd && passWd.length != 0) { if (ip && player && player.length != 0 && passWd && passWd.length != 0) {
// 页面第一次渲染时,通过socket中间件向ygopro服务端请求建立长连接 const init = async () => {
socketMiddleWare({ // 页面第一次渲染时,通过socket中间件向ygopro服务端请求建立长连接
cmd: socketCmd.CONNECT, socketMiddleWare({
initInfo: { cmd: socketCmd.CONNECT,
ip, initInfo: {
player, ip,
passWd, player,
}, passWd,
}); },
} });
// 初始化sqlite
await sqliteMiddleWare({
cmd: sqliteCmd.INIT,
initInfo: { dbUrl: "/ygopro-database/locales/zh-CN/cards.cdb" },
});
};
// 初始化sqlite init();
sqliteMiddleWare({ }
cmd: sqliteCmd.INIT,
initInfo: { dbUrl: "/ygopro-database/locales/zh-CN/cards.cdb" },
});
}, []); }, []);
const dispatch = store.dispatch; const dispatch = store.dispatch;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment