1
0

fix: do upsert instead of insert for bilibili_user

This commit is contained in:
alikia2x (寒寒) 2026-01-09 14:11:35 +08:00
parent 51ef6780a6
commit 217610a53f
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: 56209E0CCD8420C6
2 changed files with 10 additions and 11 deletions

View File

@ -15,6 +15,7 @@
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef/console_6.sql" value="0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef/console_7.sql" value="0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef/console_8.sql" value="0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef/console_9.sql" value="0d2dd3d3-bd27-4e5f-b0fa-ff14fb2a6bef" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/360f07a5-22e0-4aa5-8453-7b7e913f2fc7/console.sql" value="360f07a5-22e0-4aa5-8453-7b7e913f2fc7" />
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/c73d5a8a-cf9a-4e08-bc75-84af9a6f1ba9/console.sql" value="c73d5a8a-cf9a-4e08-bc75-84af9a6f1ba9" />
</component>

View File

@ -70,26 +70,24 @@ export const getVideoInfoWorker = async (job: Job<GetVideoInfoJobData>): Promise
uid: uid,
});
const userExists = await userExistsInBiliUsers(aid);
if (!userExists) {
await db.insert(bilibiliUser).values({
await db
.insert(bilibiliUser)
.values({
avatar: data.View.owner.face,
desc: data.Card.card.sign,
fans: data.Card.follower,
uid,
username: data.View.owner.name,
});
} else {
await db
.update(bilibiliUser)
.set({
})
.onConflictDoUpdate({
set: {
avatar: data.View.owner.face,
desc: data.Card.card.sign,
fans: data.Card.follower,
username: data.View.owner.name,
})
.where(eq(bilibiliUser.uid, uid));
}
},
target: bilibiliUser.uid,
});
const stat = data.View.stat;