forked from xiaobaiweinuli/aipan-netdisk-search
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat-add-admin-panel
# Conflicts: # components/layout/Footer.vue # components/layout/netdisk/Header.vue
- Loading branch information
Showing
4 changed files
with
131 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
<p class="font-mono text-[12px] text-center text-gray-400"> | ||
爱盼-网盘资源搜索 | ||
</p> | ||
|
||
</div> | ||
</template> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import prisma from "~/lib/prisma"; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const body = await readBody(event); // 读取请求体 | ||
const { ids } = body; // 期望接收到一个包含 ID 的数组 | ||
const userId = event.context.user.userId; // 获取用户 ID(如果需要) | ||
|
||
if (!Array.isArray(ids) || ids.length === 0) { | ||
throw createError({ statusCode: 400, statusMessage: 'Invalid request: No IDs provided' }); | ||
} | ||
|
||
try { | ||
// 使用 Prisma 的 deleteMany 方法删除多个资源 | ||
await prisma.resource.deleteMany({ | ||
where: { | ||
id: { | ||
in: ids.map(id => Number(id)), // 将 ID 转换为数字 | ||
}, | ||
}, | ||
}); | ||
|
||
return { | ||
code: 200, | ||
msg: 'Resources deleted successfully', | ||
data: [], | ||
}; | ||
} catch (error) { | ||
console.error('Error deleting resources:', error); | ||
throw createError({ statusCode: 500, statusMessage: 'Failed to delete resources' }); | ||
} | ||
}); |