diff --git a/db/database.db b/db/database.db index 2615cbe..ce91ff0 100644 Binary files a/db/database.db and b/db/database.db differ diff --git a/router/videoInfo.js b/router/videoInfo.js index fb34bf4..3fa45ae 100644 --- a/router/videoInfo.js +++ b/router/videoInfo.js @@ -2,7 +2,7 @@ const Router = require("koa-router") const { serach, gen_douban } = require("../util/ptgen") const axios = require("axios") const cheerio = require("cheerio"); -const {addSub, getSub} = require("../util/sql/video"); // HTML页面解析 +const {addSub, getSub, delSub} = require("../util/sql/video"); // HTML页面解析 const router = new Router({ prefix: "/videoInfo" @@ -70,4 +70,13 @@ router.get("/getImdbName", async (ctx) => { ctx.body = $("h1").text() }) +router.get("/delSubscribe",async (ctx)=>{ + try { + await delSub(ctx.query.id) + ctx.body = "删除成功" + }catch { + ctx.body = "删除失败" + } +}) + module.exports = router \ No newline at end of file diff --git a/util/sql/video.js b/util/sql/video.js index 0578b48..b7ebd03 100644 --- a/util/sql/video.js +++ b/util/sql/video.js @@ -18,8 +18,14 @@ async function getSub(){ return list } +async function delSub(id){ + let sql = `delete from VideoInfo where id=${id}` + await run(sql) +} + module.exports = { addSub, - getSub + getSub, + delSub } \ No newline at end of file diff --git a/view/src/api/Video.js b/view/src/api/Video.js index af6da73..98d0c98 100644 --- a/view/src/api/Video.js +++ b/view/src/api/Video.js @@ -31,4 +31,13 @@ export async function addSubscribe({name, rename, desc, year, season, ep, url, i export async function getSubscribe(){ return await base.get("/videoInfo/getSubscribe") +} + +export async function delSubscribe(id){ + return await base.get("/videoInfo/delSubscribe",{ + params:{ + id + } + }) + } \ No newline at end of file diff --git a/view/src/page/subscribe/subscribe.vue b/view/src/page/subscribe/subscribe.vue index e2216e6..15030ee 100644 --- a/view/src/page/subscribe/subscribe.vue +++ b/view/src/page/subscribe/subscribe.vue @@ -7,7 +7,7 @@ {{i.name}}
- 编辑 + 删除
@@ -18,13 +18,47 @@