添加验证

This commit is contained in:
pplok 2020-01-17 15:33:56 +08:00
parent 878337a2f2
commit 716090b6ef
6 changed files with 75 additions and 53 deletions

View File

@ -52,10 +52,14 @@ let gethtml = async (name) => {
let getlist = (name) => {
return new Promise(async (res,rej)=>{
try {
let html;
html = await gethtml(name)
// console.log(JSON.stringify(html))
res(html);
} catch (error) {
rej([])
}
})
}

View File

@ -45,10 +45,15 @@ let gethtml = async (name, page) => {
let getlist = (name) => {
return new Promise(async (res,rej)=>{
try {
let html;
html = await gethtml(name, 1)
// console.log(JSON.stringify(html))
res(html);
} catch (error) {
rej([])
}
})
}

View File

@ -82,6 +82,7 @@ let gethtml = (name) => {
let get = (name) => {
return new Promise(async (res, rej) => {
try {
let html;
await gethtml(name).then((res) => {
html = res
@ -115,6 +116,10 @@ let get = (name) => {
list = { name: "扑飞漫画", list }
res(list);
} catch (error) {
rej([])
}
})
}

View File

@ -74,6 +74,8 @@ let gethtml = (name) => {
let get = (name) => {
return new Promise(async (res,rej)=>{
try {
let html;
await gethtml(name).then((res) => {
html = res
@ -106,6 +108,9 @@ let get = (name) => {
list = {name:"塔多漫画",list}
res(list);
} catch (error) {
rej([])
}
})
}

View File

@ -28,26 +28,29 @@ let findlist = async (ctx, next) => {
pro.push(reptilelist[i].find(ctx.query.name))
}
await Promise.all(pro).then((res) => {
await Promise.allSettled(pro).then((res) => {
// console.log(res)
for (let i in res) {
for (let j in res[i].list) {
if(i.status == "fulfilled"){
for (let j in res[i].value.list) {
let has = true
for (let k in list) {
if (list[k].name == res[i].list[j].name) {
if (list[k].name == res[i].value.list[j].name) {
if (list[k].list == undefined) {
list[k].list = []
}
has = false
list[k].list.push({ name: res[i].name, url: res[i].list[j].url, date: res[i].list[j].date, update: res[i].list[j].update })
list[k].list.push({ name: res[i].value.name, url: res[i].value.list[j].url, date: res[i].value.list[j].date, update: res[i].value.list[j].update })
}
}
if (has) {
list.push({ name: res[i].list[j].name, list: [{ name: res[i].name, url: res[i].list[j].url, date: res[i].list[j].date, update: res[i].list[j].update }] })
list.push({ name: res[i].value.list[j].name, list: [{ name: res[i].value.name, url: res[i].value.list[j].url, date: res[i].value.list[j].date, update: res[i].value.list[j].update }] })
}
}
}
}
})