2023-06-20 22:34:27 +08:00
|
|
|
const { run } = require("./base");
|
2023-06-28 21:11:21 +08:00
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path")
|
2023-06-20 22:34:27 +08:00
|
|
|
function initTable(){
|
|
|
|
// 创建下载列表
|
2023-06-28 21:11:21 +08:00
|
|
|
/**
|
|
|
|
* id
|
|
|
|
* title 剧集标题
|
|
|
|
* url 剧集链接
|
|
|
|
* save 保存地址
|
|
|
|
* downDate 添加下载日期 时间戳
|
|
|
|
* isOk 是否下载完成 0 未完成 1 完成
|
|
|
|
*/
|
2023-06-20 22:34:27 +08:00
|
|
|
let sql = `create table download (
|
|
|
|
id INT PRIMARY KEY NOT NULL autoincrement,
|
|
|
|
title VARCHAR(255) not null,
|
|
|
|
url varchar(255) not null,
|
2023-06-28 21:11:21 +08:00
|
|
|
save varcahr(255) not null,
|
|
|
|
downDate INTEGER not null,
|
|
|
|
isOk INTEGER not null
|
2023-06-20 22:34:27 +08:00
|
|
|
)`
|
|
|
|
run(sql)
|
|
|
|
}
|
|
|
|
|
2023-06-28 21:11:21 +08:00
|
|
|
function init(){
|
|
|
|
let isexists = fs.existsSync(path.join(__dirname,"/db/database.db"))
|
|
|
|
if(!isexists){
|
|
|
|
initTable()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-06-20 22:34:27 +08:00
|
|
|
module.exports = {
|
2023-06-28 21:11:21 +08:00
|
|
|
init
|
2023-06-20 22:34:27 +08:00
|
|
|
}
|