fix: do upsert instead of insert for bilibili_user
This commit is contained in:
parent
51ef6780a6
commit
217610a53f
@ -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>
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user