add 获取订阅列表
This commit is contained in:
parent
25e68ab1d0
commit
54e6932dc2
BIN
db/database.db
BIN
db/database.db
Binary file not shown.
@ -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,
|
||||
|
@ -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
|
||||
}
|
@ -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}) {
|
||||
return await base.post("/videoInfo/addSubscribe", {name, rename, desc, year, season, ep, url, img, subtitle, time,skip,sid})
|
||||
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")
|
||||
|
||||
}
|
@ -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]){
|
||||
|
@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="list">
|
||||
<div class="item" v-for="i in 16">
|
||||
<div class="item" v-for="i in list">
|
||||
<el-card :body-style="{ padding: '0px' }">
|
||||
<img src="https://puui.qpic.cn/vcover_vt_pic/0/ww18u675tfmhas61669188848910/260" class="image" />
|
||||
<img :src="i.img" class="image" />
|
||||
<div style="padding: 14px">
|
||||
<span>一念永恒</span>
|
||||
<span>{{i.name}}</span>
|
||||
<div class="bottom">
|
||||
<time class="time">正在订阅:100/104</time>
|
||||
<time class="time">正在订阅:{{i.skip}}/{{i.count}}</time>
|
||||
<el-button text class="button">编辑</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@ -17,6 +17,15 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {onMounted, ref} from "vue";
|
||||
import {getSubscribe} from '../../api/Video.js'
|
||||
|
||||
const list = ref([])
|
||||
onMounted(async ()=>{
|
||||
const res = await getSubscribe()
|
||||
list.value = res.data
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
Loading…
Reference in New Issue
Block a user