diff --git a/db/database.db b/db/database.db index 70ce26c..2615cbe 100644 Binary files a/db/database.db and b/db/database.db differ diff --git a/router/videoInfo.js b/router/videoInfo.js index e291972..fb34bf4 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} = require("../util/sql/video"); // HTML页面解析 +const {addSub, getSub} = require("../util/sql/video"); // HTML页面解析 const router = new Router({ prefix: "/videoInfo" @@ -52,6 +52,11 @@ router.post("/addSubscribe", async (ctx) => { }) +router.get("/getSubscribe",async (ctx)=>{ + let list = await getSub() + ctx.body = list +}) + router.get("/getImdbName", async (ctx) => { let res = await axios.get(ctx.query.url, { proxy: false, diff --git a/util/sql/video.js b/util/sql/video.js index a0edda3..0578b48 100644 --- a/util/sql/video.js +++ b/util/sql/video.js @@ -8,11 +8,18 @@ async function addSub(info){ if(list.length != 0){ return "订阅已存在" } - let sql = `insert into VideoInfo(name,rename,skip,desc,url,subtitle,img,year,time,subTime,enable,season,sid) values(?,?,?,?,?,?,?,?,?,${new Date().getTime()},1,?,?)` - await run(sql,info.name,info.rename,info.skip,info.desc,info.url,info.subtitle,info.img,info.year,info.time,info.season,info.sid) + let sql = `insert into VideoInfo(name,rename,skip,desc,url,subtitle,img,year,time,subTime,enable,season,sid,count) values(?,?,?,?,?,?,?,?,?,${new Date().getTime()},1,?,?,?)` + await run(sql,info.name,info.rename,info.skip,info.desc,info.url,info.subtitle,info.img,info.year,info.time,info.season,info.sid,info.count) +} + +async function getSub(){ + let sql = `select * from VideoInfo` + let list = await getAll(sql) + return list } module.exports = { - addSub + addSub, + getSub } \ No newline at end of file diff --git a/view/src/api/Video.js b/view/src/api/Video.js index 993960d..af6da73 100644 --- a/view/src/api/Video.js +++ b/view/src/api/Video.js @@ -24,7 +24,11 @@ export async function getImdbName(url) { } }) } +export async function addSubscribe({name, rename, desc, year, season, ep, url, img, subtitle, time,skip,sid,count}) { + return await base.post("/videoInfo/addSubscribe", {name, rename, desc, year, season, ep, url, img, subtitle, time,skip,sid,count}) +} + +export async function getSubscribe(){ + return await base.get("/videoInfo/getSubscribe") -export async function addSubscribe({name, rename, desc, year, season, ep, url, img, subtitle, time,skip,sid}) { - return await base.post("/videoInfo/addSubscribe", {name, rename, desc, year, season, ep, url, img, subtitle, time,skip,sid}) } \ No newline at end of file diff --git a/view/src/page/subscribe/addSubscribe.vue b/view/src/page/subscribe/addSubscribe.vue index 947309d..5ba0152 100644 --- a/view/src/page/subscribe/addSubscribe.vue +++ b/view/src/page/subscribe/addSubscribe.vue @@ -70,6 +70,7 @@ const subtitle = ref("") const img = ref("") const time = ref("") const name = ref("") +const count = ref(0) async function onSubmit(name) { let res = await searchVideo(name) list.value = res.data.data @@ -94,6 +95,7 @@ async function getInfo(id, i) { info.value = res.data.format year.value = res.data.year subtitle.value = res.data.trans_title.join(" / ") + count.value = res.data.episodes name.value = res.data.chinese_title enName.value = "" if(res.data.imdb_link){ @@ -123,7 +125,8 @@ async function addsubscribe() { subtitle: subtitle.value, time: dayjs(time.value).format("HH:mm:ss"), skip:season.value, - sid:vid + sid:vid, + count:count.value } for(let i in data){ if(!data[i]){ diff --git a/view/src/page/subscribe/subscribe.vue b/view/src/page/subscribe/subscribe.vue index f6b1884..e2216e6 100644 --- a/view/src/page/subscribe/subscribe.vue +++ b/view/src/page/subscribe/subscribe.vue @@ -1,12 +1,12 @@