This commit is contained in:
raohaotian 2025-04-12 18:31:08 +08:00
parent 55e5412f5e
commit 946969b503
3 changed files with 39 additions and 1528 deletions

View File

@ -111,7 +111,7 @@ export class ShareCodeService extends BaseService<Prisma.ShareCodeDelegate> {
let existingShareCode;
do {
// 查找是否已有相同 shareCode 或者相同 FileID 的分享码记录
existingShareCode = await super.findUnique({
existingShareCode = await super.findFirst({
where: {
OR: [
{ code },
@ -120,6 +120,9 @@ export class ShareCodeService extends BaseService<Prisma.ShareCodeDelegate> {
},
});
// 如果找到的是已经被删除的码,则可以使用并更新其他信息,否则重新生成
if(!existingShareCode){
break
}
if (existingShareCode.deleteAt !== null) {
break
}
@ -141,7 +144,7 @@ export class ShareCodeService extends BaseService<Prisma.ShareCodeDelegate> {
fileName: filename || "downloaded_file",
uploadIp,
createdAt: new Date(),
deleteAt: null
deletedAt: null
},
});
} else {
@ -403,7 +406,7 @@ export class ShareCodeService extends BaseService<Prisma.ShareCodeDelegate> {
},
select: { ...ShareCodeSelect }
});
const {totalSize, resourceCount} = this.calculateTotalSize(shareCodes);
const {totalSize, resourceCount} = this.calculateTotalSize(shareCodes as any as GenerateShareCodeResponse[]);
this.logger.log(`资源总大小: ${totalSize}, 资源数量: ${resourceCount}`);
return { totalSize, resourceCount };
@ -446,7 +449,7 @@ export class ShareCodeService extends BaseService<Prisma.ShareCodeDelegate> {
...ShareCodeSelect
}
});
const {totalSize, resourceCount} = this.calculateTotalSize(shareCodes);
const {totalSize, resourceCount} = this.calculateTotalSize(shareCodes as any as GenerateShareCodeResponse[]);
this.logger.log(`${dateType}资源总大小: ${totalSize}, 资源数量: ${resourceCount}`);
return { totalSize, resourceCount };
} catch (error) {

View File

@ -57,7 +57,6 @@
"framer-motion": "^11.15.0",
"hls.js": "^1.5.18",
"idb-keyval": "^6.2.1",
"mind-elixir": "workspace:^",
"mitt": "^3.0.1",
"quill": "2.0.3",
"react": "18.2.0",

File diff suppressed because it is too large Load Diff