40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const { run, getAll } = require("./base");
|
|
const dayjs = require("dayjs");
|
|
|
|
async function addSub(info){
|
|
|
|
let selSql = `select * from VideoInfo where sid='${info.sid}' and season=${info.season}`
|
|
let list = await getAll(selSql)
|
|
if(list.length != 0){
|
|
return "订阅已存在"
|
|
}
|
|
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 where enable=1`
|
|
let list = await getAll(sql)
|
|
return list
|
|
}
|
|
|
|
|
|
|
|
async function delSub(id){
|
|
let sql = `delete from VideoInfo where id=${id}`
|
|
await run(sql)
|
|
}
|
|
|
|
async function updateSkip(num,id){
|
|
let sql = `update VideoInfo set skip=${num} where id=${id}`
|
|
await run(sql)
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
addSub,
|
|
getSub,
|
|
delSub,
|
|
updateSkip
|
|
} |