From 47e47f2b12bc5f3e4b8074c9b6440e233b63974e Mon Sep 17 00:00:00 2001 From: alikia2x Date: Sun, 2 Mar 2025 18:48:01 +0800 Subject: [PATCH] add: func:getUnArchivedBiliUsers --- lib/db/allData.ts | 14 ++++++++++++++ lib/mq/exec/getBiliUserInfo.ts | 0 2 files changed, 14 insertions(+) create mode 100644 lib/mq/exec/getBiliUserInfo.ts diff --git a/lib/db/allData.ts b/lib/db/allData.ts index 82e1654..7c4d990 100644 --- a/lib/db/allData.ts +++ b/lib/db/allData.ts @@ -48,3 +48,17 @@ export async function getVideoInfoFromAllData(client: Client, aid: number) { author_info: authorInfo }; } + +export async function getUnArchivedBiliUsers(client: Client) { + const queryResult = await client.queryObject<{uid: number}>( + ` + SELECT ad.uid + FROM all_data ad + LEFT JOIN bili_user bu ON ad.uid = bu.uid + WHERE bu.uid IS NULL; + `, + [] + ); + const rows = queryResult.rows; + return rows.map((row) => row.uid); +} diff --git a/lib/mq/exec/getBiliUserInfo.ts b/lib/mq/exec/getBiliUserInfo.ts new file mode 100644 index 0000000..e69de29