From 54e6932dc2379358c7cbf9f90f34f3c1ebd28867 Mon Sep 17 00:00:00 2001 From: Theluyuan <1162963624@qq.com> Date: Thu, 13 Jul 2023 09:44:47 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E8=8E=B7=E5=8F=96=E8=AE=A2=E9=98=85?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/database.db | Bin 32768 -> 32768 bytes router/videoInfo.js | 7 ++++++- util/sql/video.js | 13 ++++++++++--- view/src/api/Video.js | 8 ++++++-- view/src/page/subscribe/addSubscribe.vue | 5 ++++- view/src/page/subscribe/subscribe.vue | 17 +++++++++++++---- 6 files changed, 39 insertions(+), 11 deletions(-) diff --git a/db/database.db b/db/database.db index 70ce26c66d2c6dbbaa7c9ac4979d27f8e16fc352..2615cbe51c9ffb5d8652084287a234caea3b23ed 100644 GIT binary patch delta 1184 zcmZuw|4&m_6o0RZrR7_pIzo_fnNf6`w0)&OnVVVAkt{KBq7k;Z(JZvog_bdzp^4#D zptex7^#TRjit@$cpcGmdZ7DR{Z~MW-e_`X@``-JBEZJ}SW%pUPv1G|T=bd-X=YGyP z_nynLGM1J3DoYzFipnPZASJOk^ zzyW2Ca(F-{mwr7L6H7%cGC6qXYrDhN5Bb8{d6lX#k1)|Ce-cgQCknwqiR8$W#kEIO z`7-Jyl~+K$^gDk#;r>8YMzz#_tWbDAtG?&7mRBjNXy~h{jMo$$Eiahtqtzt*p+XTk zRqd?&JO1i&CH&}yJaOstt}=dAu2Rs1{g@;PRp%ci$7tnEN_jI;s=A_VA3JlTj55}q zQ_!%cqE=#{t7tCCa_Kae8sm~rjv0>zPksM8RjT)U6nEUKKfH5$J2H4qp;bbFY&@wuWgcpMnj4V94PPC4J zYnHl;;*6UgS_U0mpryOZ_PX}WR1Swc5n}uoK#Jp6Qus+g48#R?1VDegT8)D#F6~Fb zJ)Da+8uD?J@uE{FGvS?Dg`c?%qHS)wc9MpT)LbF zfP96mEfGfXW*l50d+&DJ9pLkBll^~yfkiyE4%)3YaJ|cBky5-B+~Ykd1l_{p8PG<0 zvVc#d(6=4OkB4z+nVh3Iop?l9ZrgwA2If>wvg27hg<7(|(;cxe{JXZKkra>dYESXz(0Tyhf!eni_#`UHp6mCzCkr-)HZm&@!G|!pRZh&mqalp|u3snL^p8d}xjj zCi&T6lh+m5mc9eO} zB}b)9iy?8xFD^V3SEh+A6%<{-(=j};$2(Wvu#-D-PfOKDo}=*udgMRIkPZ{X`SbQa zWuN9_4^SqJMzf?PVLnPQj83m(^oPgY0PkruwDe>u;H&Eur<&fpo4VV*79fqc*4SLn OG#iY0dP8nl3;zP~pf7a* delta 208 zcmZo@U}|V!njkG`%)r3F0mSS;%mT!M6LpM%f_iB$d3pI5n7Q&8xKHxV-dM1ZhrL%^ zUY@ZzdvXO=GgnIz6FZ38DZII#*O_VZHy(*a0s=g|Kogi4E;6w4GF;ruqwt=e)!5R| z*kY3bivSxVs}KXL(8fj%R{p8kY(fmq>b9Jm%auhNr6=E45S?t`D#UJLW?*V;Xu8=; v^*QHcMOW#`0sf14jf|{}O^i*=ASMN{3ve<6Z2`HNb+bUi7yivG0e|=bEjljV 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 @@