换系统

This commit is contained in:
pplokijuhyg 2019-12-26 17:37:51 +08:00
parent 1be20ea269
commit a3a4991dd1
13 changed files with 3472 additions and 3469 deletions

View File

@ -1,4 +1,4 @@
# 我的koa模板 # 我的koa模板
- bin 基础依赖 - bin 基础依赖
- cmntroller 路由文件地址 - cmntroller 路由文件地址
- app.js 入口文件 - app.js 入口文件

44
app.js
View File

@ -1,23 +1,23 @@
const Koa = require("koa"); const Koa = require("koa");
const requter = require("./bin/router.js"); const requter = require("./bin/router.js");
dbs = require("./bin/mongodb.js")('mongodb://localhost:27017/Cartoon-And-Fiction',"Cartoon-And-Fiction") dbs = require("./bin/mongodb.js")('mongodb://localhost:27017/Cartoon-And-Fiction',"Cartoon-And-Fiction")
// console.log(requter) // console.log(requter)
// import requter from "./bin/router" // import requter from "./bin/router"
const app = new Koa(); const app = new Koa();
app.use(async (ctx,next)=>{ app.use(async (ctx,next)=>{
// await next(); // await next();
console.log(ctx.url) console.log(ctx.url)
// console.time("asd") // console.time("asd")
// ctx.response.body = {a:1}; // ctx.response.body = {a:1};
await next() await next()
// console.log("执行") // console.log("执行")
// console.timeEnd("asd") // console.timeEnd("asd")
}); });
const bodyParser = require('koa-bodyparser'); const bodyParser = require('koa-bodyparser');
app.use(bodyParser()); app.use(bodyParser());
// console.log(requter()) // console.log(requter())
app.use(requter()); app.use(requter());
app.listen(3002); app.listen(3002);
console.log("http://localhost:3002") console.log("http://localhost:3002")

View File

@ -1,22 +1,23 @@
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const Axios = require('axios') const Axios = require('axios')
async function downloadFile(url, filepath, name) { async function downloadFile(url, filepath, name) {
if (!fs.existsSync(filepath)) { if (!fs.existsSync(filepath)) {
fs.mkdirSync(filepath); fs.mkdirSync(filepath);
} }
const mypath = path.resolve(filepath, name); const mypath = path.resolve(filepath, name);
const writer = fs.createWriteStream(mypath); const writer = fs.createWriteStream(mypath);
const response = await Axios({ const response = await Axios({
url, url,
method: "GET", method: "GET",
responseType: "stream", responseType: "stream",
}); });
response.data.pipe(writer); response.data.pipe(writer);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
writer.on("finish", resolve); writer.on("finish", resolve);
writer.on("error", reject); writer.on("error", reject);
}); });
} }
// downloadFile("https://www.cnblogs.com/images/logo_small.gif",__dirname + "/dow",'asd.gif') // downloadFile("https://www.cnblogs.com/images/logo_small.gif",__dirname + "/dow",'asd.gif')
module.exports = downloadFile

View File

@ -1,205 +1,205 @@
var MongoClient = require('mongodb').MongoClient; var MongoClient = require('mongodb').MongoClient;
var dburl; var dburl;
let idadd = async (set) => { let idadd = async (set) => {
let id = 0 let id = 0
if (set == "idadd") { if (set == "idadd") {
return 0; return 0;
} else { } else {
await find('idadd', { 'set': set }).then((res) => { await find('idadd', { 'set': set }).then((res) => {
if (res.data.length != 0) { if (res.data.length != 0) {
id = res.data[0].num_key id = res.data[0].num_key
} else { } else {
id = 1 id = 1
} }
}) })
} }
if (id == 1) { if (id == 1) {
await add('idadd', { set, 'num_key': 2 }) await add('idadd', { set, 'num_key': 2 })
} else if (set != "idadd") { } else if (set != "idadd") {
console.log(id) console.log(id)
await update('idadd', { 'set': set }, { 'num_key': id + 1 }) await update('idadd', { 'set': set }, { 'num_key': id + 1 })
} }
console.log(id) console.log(id)
return id return id
} }
let add = async (set, data, url = dburl) => { let add = async (set, data, url = dburl) => {
if (set != "idadd") { if (set != "idadd") {
let id = await idadd(set) let id = await idadd(set)
data.num_key = id data.num_key = id
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
try { try {
dbo.collection(set).insertOne(data, function (err, res) { dbo.collection(set).insertOne(data, function (err, res) {
if (err) throw err; if (err) throw err;
db.close(); db.close();
resolve({ code: 0 ,msg:"添加成功"}); resolve({ code: 0 ,msg:"添加成功"});
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
}) })
} }
let adds = async (set, data, url = dburl) => { let adds = async (set, data, url = dburl) => {
if (set != "idadd") { if (set != "idadd") {
for (let i in data) { for (let i in data) {
let id = await idadd(set) let id = await idadd(set)
data[i].num_key = id data[i].num_key = id
} }
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
try { try {
dbo.collection(set).insertMany(data, function (err, res) { dbo.collection(set).insertMany(data, function (err, res) {
if (err) throw err; if (err) throw err;
db.close(); db.close();
resolve({ code: 0, num: res.insertedCount }); resolve({ code: 0, num: res.insertedCount });
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
}) })
} }
let remove = async (set, where, url = dburl) => { let remove = async (set, where, url = dburl) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
try { try {
dbo.collection(set).deleteOne(where, function (err, obj) { dbo.collection(set).deleteOne(where, function (err, obj) {
if (err) throw err; if (err) throw err;
db.close(); db.close();
resolve({ code: 0 }); resolve({ code: 0 });
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
}) })
} }
let removes = async (set, where, url = dburl) => { let removes = async (set, where, url = dburl) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (where == "" || Object.keys(where).length == 0) { if (where == "" || Object.keys(where).length == 0) {
reject({ code: 1 }) reject({ code: 1 })
} }
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
try { try {
dbo.collection(set).deleteMany(where, function (err, obj) { dbo.collection(set).deleteMany(where, function (err, obj) {
if (err) throw err; if (err) throw err;
db.close(); db.close();
resolve({ code: 0, num: obj.result.n }); resolve({ code: 0, num: obj.result.n });
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
}) })
} }
let find = async (set, where = {}, page = 0, num = 0, url = dburl) => { let find = async (set, where = {}, page = 0, num = 0, url = dburl) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (num == 0) { if (num == 0) {
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
try { try {
dbo.collection(set).find(where).toArray(function (err, result) { dbo.collection(set).find(where).toArray(function (err, result) {
if (err) throw err; if (err) throw err;
resolve({ code: 0, data: result }); resolve({ code: 0, data: result });
db.close(); db.close();
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
} else { } else {
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
try { try {
dbo.collection(set).find(where).skip(num * page).limit(num).toArray(function (err, result) { dbo.collection(set).find(where).skip(num * page).limit(num).toArray(function (err, result) {
if (err) throw err; if (err) throw err;
resolve({ code: 0, data: result }); resolve({ code: 0, data: result });
db.close(); db.close();
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
} }
}) })
} }
let update = async (set, where = {}, data, defin = true, url = dburl) => { let update = async (set, where = {}, data, defin = true, url = dburl) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
if (defin) { if (defin) {
data = { $set: data } data = { $set: data }
} }
try { try {
dbo.collection(set).updateOne(where, data, function (err, res) { dbo.collection(set).updateOne(where, data, function (err, res) {
if (err) throw err; if (err) throw err;
resolve({ code: 0 }); resolve({ code: 0 });
db.close(); db.close();
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
}) })
} }
let updates = async (set, where = {}, data, url = dburl) => { let updates = async (set, where = {}, data, url = dburl) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) { MongoClient.connect(url.url, { useUnifiedTopology: true, useNewUrlParser: true }, function (err, db) {
if (err) throw err; if (err) throw err;
var dbo = db.db(url.dbname); var dbo = db.db(url.dbname);
data = { $set: data } data = { $set: data }
try { try {
dbo.collection(set).updateMany(where, data, function (err, res) { dbo.collection(set).updateMany(where, data, function (err, res) {
if (err) throw err; if (err) throw err;
db.close(); db.close();
resolve({ code: 0, num: res.result.nModified }); resolve({ code: 0, num: res.result.nModified });
}); });
} catch (error) { } catch (error) {
reject({ code: 1, error }) reject({ code: 1, error })
} }
}); });
}) })
} }
module.exports = function (url, dbname) { module.exports = function (url, dbname) {
dburl = { url, dbname }; dburl = { url, dbname };
return { return {
add, add,
adds, adds,
remove, remove,
find, find,
update, update,
updates, updates,
removes removes
} }
} }

View File

@ -1,4 +1,4 @@
古风漫画网 古风漫画网
www.gufengmh8.com www.gufengmh8.com
find.js 查找功能 find.js 查找功能
section.js 获取章节列表 section.js 获取章节列表

View File

@ -1,43 +1,43 @@
let axios = require('axios') let axios = require('axios')
const cheerio = require('cheerio'); const cheerio = require('cheerio');
const qs = require('querystring'); const qs = require('querystring');
let getcontlist = async (text) => { let getcontlist = async (text) => {
let $ = cheerio.load(text) let $ = cheerio.load(text)
let list = [] let list = []
$ = cheerio.load($("#contList").eq(0).html()) $ = cheerio.load($("#contList").eq(0).html())
// console.log($("li").eq(0).html()) // console.log($("li").eq(0).html())
$("li").each((index,ele)=>{ $("li").each((index,ele)=>{
let j = cheerio.load($(ele).html(),{decodeEntities: false}) let j = cheerio.load($(ele).html(),{decodeEntities: false})
// console.log(unescape(j('.tt').eq(0).html())) // console.log(unescape(j('.tt').eq(0).html()))
let obj = {}; let obj = {};
obj.update = j('.tt').eq(0).html() obj.update = j('.tt').eq(0).html()
obj.name = j(".ell a").eq(0).html() obj.name = j(".ell a").eq(0).html()
obj.date = j(".updateon").eq(0).html().replace(/\s+/g,"").replace('<em>1.0</em>','') obj.date = j(".updateon").eq(0).html().replace(/\s+/g,"").replace('<em>1.0</em>','')
obj.url = j(".cover").eq(0).attr('href') obj.url = j(".cover").eq(0).attr('href')
// console.log(obj) // console.log(obj)
list.push(obj) list.push(obj)
}) })
return list return list
} }
let gethtml = async (name, page) => { let gethtml = async (name, page) => {
name = qs.escape(name) name = qs.escape(name)
let url = `https://www.gufengmh8.com/search/?keywords=${name}&page=${page}` let url = `https://www.gufengmh8.com/search/?keywords=${name}&page=${page}`
// console.log(url) // console.log(url)
let text = "" let text = ""
await axios.get(url).then((a) => { await axios.get(url).then((a) => {
// console.log(a.text) // console.log(a.text)
// res(a.text) // res(a.text)
text = a.data text = a.data
}) })
return await getcontlist(text) return await getcontlist(text)
} }
let getlist = async (name) => { let getlist = async (name) => {
let html; let html;
html = await gethtml(name, 1) html = await gethtml(name, 1)
console.log(html) console.log(JSON.stringify(html))
return html; return html;
} }
getlist("偷星九月天") getlist("偷星九月天")
// module.exports = getlist // module.exports = getlist

View File

@ -1,32 +1,32 @@
const cheerio = require('cheerio'); const cheerio = require('cheerio');
const axios = require('axios') const axios = require('axios')
let getscript = async (url) => { let getscript = async (url) => {
let text; let text;
await axios.get('https://www.gufengmh8.com/manhua/touxingjiuyuetian/1152122.html').then((res)=>{ await axios.get('https://www.gufengmh8.com/manhua/touxingjiuyuetian/1152122.html').then((res)=>{
// text = res.text // text = res.text
// console.log(res.data) // console.log(res.data)
text = res.data text = res.data
}) })
let $ = cheerio.load(text); let $ = cheerio.load(text);
$('script').each((index, ele) => { $('script').each((index, ele) => {
// console.log(ele) // console.log(ele)
let text = $(ele).html() let text = $(ele).html()
if (text.search('chapterImages') != -1) { if (text.search('chapterImages') != -1) {
eval(text) eval(text)
var reg = /^http(s)?:\/\/(.*?)\// var reg = /^http(s)?:\/\/(.*?)\//
imghost = reg.exec(pageImage)[2] imghost = reg.exec(pageImage)[2]
// imghost 图片域名 // imghost 图片域名
// chapterPath 图片基本链接path // chapterPath 图片基本链接path
// chapterImages 图片地址数组 // chapterImages 图片地址数组
// pageTitle 标题 // pageTitle 标题
// pageUrl 页面基础url // pageUrl 页面基础url
// prevChapterData 上一页信息 // prevChapterData 上一页信息
// nextChapterData 下一页信息 // nextChapterData 下一页信息
// 页面地址为 基础url + 页信息.id // 页面地址为 基础url + 页信息.id
console.log({ imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage }) console.log({ imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage })
return { imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage } return { imghost, chapterPath, chapterImages, pageTitle, pageUrl, prevChapterData, nextChapterData, pageImage }
} }
}) })
} }
getscript('') getscript('')

View File

@ -1,39 +1,39 @@
let axios = require('axios') let axios = require('axios')
const cheerio = require('cheerio'); const cheerio = require('cheerio');
let getsection = async (text)=>{ let getsection = async (text)=>{
let $ = cheerio.load(text) let $ = cheerio.load(text)
let list = []; let list = [];
// console.log($(".comic-chapters ").eq(0).html()) // console.log($(".comic-chapters ").eq(0).html())
$(".comic-chapters").each((index,ele)=>{ $(".comic-chapters").each((index,ele)=>{
// $(ele) // $(ele)
// console.log($(ele).html()) // console.log($(ele).html())
let obj = {} let obj = {}
let j = cheerio.load($(ele).html(),{decodeEntities: false}) let j = cheerio.load($(ele).html(),{decodeEntities: false})
obj.title = j(".pull-left").eq(0).html().replace('<span>','').replace('</span>','') obj.title = j(".pull-left").eq(0).html().replace('<span>','').replace('</span>','')
obj.list = [] obj.list = []
j('li').each(function (index,ele){ j('li').each(function (index,ele){
let con = {} let con = {}
con.url = j(this).find("a").eq(0).attr('href') con.url = j(this).find("a").eq(0).attr('href')
con.title = j(this).find("a").eq(0).html().replace('<span>','').replace('</span>','').replace(/\s+/g,"").replace('\\n','') con.title = j(this).find("a").eq(0).html().replace('<span>','').replace('</span>','').replace(/\s+/g,"").replace('\\n','')
obj.list.push(con) obj.list.push(con)
}) })
// console.log(obj) // console.log(obj)
list.push(obj) list.push(obj)
}) })
// console.log(list) // console.log(list)
return list return list
} }
let gethtml = async (url)=>{ let gethtml = async (url)=>{
let text; let text;
await axios.get(url).then((res)=>{ await axios.get(url).then((res)=>{
text = res.data text = res.data
}) })
let list = await getsection(text) let list = await getsection(text)
// console.log(JSON.stringify(list)) // console.log(JSON.stringify(list))
return list return list
} }
// gethtml('https://www.gufengmh8.com/manhua/touxingjiuyuetian/') // gethtml('https://www.gufengmh8.com/manhua/touxingjiuyuetian/')
module.exports = gethtml module.exports = gethtml

View File

@ -1,47 +1,47 @@
const fs = require("fs") const fs = require("fs")
const os = require('os'); const os = require('os');
function addMapping(router, mapping) { function addMapping(router, mapping) {
for (var url in mapping) { for (var url in mapping) {
if (url.startsWith('GET ')) { if (url.startsWith('GET ')) {
var path = url.substring(4); var path = url.substring(4);
router.get(path, mapping[url]); router.get(path, mapping[url]);
// console.log(`register URL mapping: GET ${path}`); // console.log(`register URL mapping: GET ${path}`);
} else if (url.startsWith('POST ')) { } else if (url.startsWith('POST ')) {
var path = url.substring(5); var path = url.substring(5);
router.post(path, mapping[url]); router.post(path, mapping[url]);
// console.log(`register URL mapping: POST ${path}`); // console.log(`register URL mapping: POST ${path}`);
} else { } else {
console.log(`invalid URL: ${url}`); console.log(`invalid URL: ${url}`);
} }
} }
} }
function addControllers(router, controllers_dir) { function addControllers(router, controllers_dir) {
let ostype = os.type() == "Windows_NT" let ostype = os.type() == "Windows_NT"
let dir; let dir;
if (ostype) { if (ostype) {
dir = __dirname.replace("\\bin", "") dir = __dirname.replace("\\bin", "")
} else { } else {
dir = __dirname.replace("/bin", "") dir = __dirname.replace("/bin", "")
} }
var files = fs.readdirSync(dir + "/" + controllers_dir); var files = fs.readdirSync(dir + "/" + controllers_dir);
var js_files = files.filter((f) => { var js_files = files.filter((f) => {
return f.endsWith('.js'); return f.endsWith('.js');
}); });
for (var f of js_files) { for (var f of js_files) {
// console.log(`process controller: ${f}...`); // console.log(`process controller: ${f}...`);
let mapping = require(dir + `/${controllers_dir}/` + f); let mapping = require(dir + `/${controllers_dir}/` + f);
addMapping(router, mapping); addMapping(router, mapping);
} }
} }
module.exports = function (dir) { module.exports = function (dir) {
let let
controllers_dir = dir || 'controllers', // 如果不传参数,扫描目录默认为'controllers' controllers_dir = dir || 'controllers', // 如果不传参数,扫描目录默认为'controllers'
router = require('koa-router')(); router = require('koa-router')();
addControllers(router, controllers_dir); addControllers(router, controllers_dir);
return router.routes(); return router.routes();
// return 1; // return 1;
}; };

View File

@ -1,18 +1,20 @@
const convert = require('webp-batch-convert'); const convert = require('webp-batch-convert');
let webg = async (dir) => { let webg = async (dir) => {
const cwebpOpts = { console.log(dir)
quiet: true, // 不输出详情 const cwebpOpts = {
q: 5 // 质量 quiet: true, // 不输出详情
}; q: 1// 质量
// 清空输出目录 };
// convert.utils.delDir(__dirname + '/webp'); // 清空输出目录
convert.utils.delDir(dir, /\.webp$/); // convert.utils.delDir(__dirname + '/webp');
res = convert.cwebp(dir,dir, cwebpOpts); convert.utils.delDir(dir, /\.webp$/);
// console.log('total: ', res); res = convert.cwebp(dir,dir, cwebpOpts);
convert.utils.delDir(dir, /\.jpg$/); // console.log('total: ', res);
convert.utils.delDir(dir, /\.png$/); convert.utils.delDir(dir, /\.jpg$/);
return res; convert.utils.delDir(dir, /\.png$/);
} return res;
}
webg(__dirname + "\\img")
module.exports = webg module.exports = webg

View File

@ -1,42 +1,42 @@
let getlist = async (ctx,next)=>{ let getlist = async (ctx,next)=>{
await dbs.find('list').then((res)=>{ await dbs.find('list').then((res)=>{
data = []; data = [];
for(let i in res.data){ for(let i in res.data){
data.push({ data.push({
id:res.data[i].num_key, id:res.data[i].num_key,
type:res.data[i].type, type:res.data[i].type,
name:res.data[i].name name:res.data[i].name
}) })
} }
ctx.body = JSON.stringify({code:0,data}) ctx.body = JSON.stringify({code:0,data})
}) })
// next() // next()
} }
//添加需要爬取的项目 name url type 0小说 1漫画 //添加需要爬取的项目 name url type 0小说 1漫画
let addproject = async (ctx,next)=>{ let addproject = async (ctx,next)=>{
if(ctx.query.name == undefined || ctx.query.url == undefined || ctx.query.type ==undefined){ if(ctx.query.name == undefined || ctx.query.url == undefined || ctx.query.type ==undefined){
ctx.body = "{code:1,msg:参数不能为空}" ctx.body = "{code:1,msg:参数不能为空}"
}else{ }else{
await dbs.add('list',{name:ctx.query.name,url:ctx.query.url,type:ctx.query.type}).then((res)=>{ await dbs.add('list',{name:ctx.query.name,url:ctx.query.url,type:ctx.query.type}).then((res)=>{
ctx.body = JSON.stringify(res) ctx.body = JSON.stringify(res)
}) })
} }
// next() // next()
} }
let rmproject = async (ctx,next) =>{ let rmproject = async (ctx,next) =>{
if(ctx.query.id == undefined){ if(ctx.query.id == undefined){
ctx.body = "{code:1,msg:参数不能为空}" ctx.body = "{code:1,msg:参数不能为空}"
}else{ }else{
await dbs.remove('list',{'num_key':ctx.query.id}).then((res)=>{ await dbs.remove('list',{'num_key':ctx.query.id}).then((res)=>{
ctx.body="{code:1,msg:删除成功}" ctx.body="{code:1,msg:删除成功}"
}) })
} }
} }
let findlist = async (ctx,next)=>{ let findlist = async (ctx,next)=>{
} }
module.exports = { module.exports = {
'GET /getlist':getlist, 'GET /getlist':getlist,
'GET /addproject':addproject, 'GET /addproject':addproject,
'GET /rmproject':rmproject 'GET /rmproject':rmproject
} }

View File

@ -1,25 +1,25 @@
{ {
"name": "wecat-serve-demo", "name": "wecat-serve-demo",
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"repository": "http://git.luyuan.tk/pplokijuhyg/wecat-serve-demo.git", "repository": "http://git.luyuan.tk/pplokijuhyg/wecat-serve-demo.git",
"author": "pplokijuhyg <1162963624@qq.com>", "author": "pplokijuhyg <1162963624@qq.com>",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"start": "node app.js" "start": "node app.js"
}, },
"dependencies": { "dependencies": {
"axios": "^0.19.0", "axios": "^0.19.0",
"cheerio": "^1.0.0-rc.3", "cheerio": "^1.0.0-rc.3",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
"koa": "^2.11.0", "koa": "^2.11.0",
"koa-bodyparser": "^4.2.1", "koa-bodyparser": "^4.2.1",
"koa-router": "^7.4.0", "koa-router": "^7.4.0",
"mongodb": "^3.3.5", "mongodb": "^3.3.5",
"path": "^0.12.7", "path": "^0.12.7",
"querystring": "^0.2.0", "querystring": "^0.2.0",
"request": "^2.88.0", "request": "^2.88.0",
"superagent": "^5.1.2", "superagent": "^5.1.2",
"webp-batch-convert": "^0.0.8" "webp-batch-convert": "^0.0.8"
} }
} }

5946
yarn.lock

File diff suppressed because it is too large Load Diff