diff --git a/controllers/article.js b/controllers/article.js index 5a4c4bc..9b6b235 100644 --- a/controllers/article.js +++ b/controllers/article.js @@ -6,13 +6,14 @@ var articlefind = async (ctx, next) => { await dbs.find("articlelists").then(async (res) => { let num=0 articlelist = res.data - await dbs.find("articletag").then((res)=>{ + await dbs.find("articletag").then( async (res)=>{ + for(let i in articlelist){ for(let m in res.data){ // console.log(res.data[m].articleid,articlelist[i].num_key,res.data[m].tagid) if(res.data[m].articleid==articlelist[i].num_key){ - console.log(res.data[m].articleid,articlelist[i].num_key,res.data[m].tagid) + // console.log(res.data[m].articleid,articlelist[i].num_key,res.data[m].tagid) // console.log(res.data[m].articleid) // console.log(res.data[m].articleid,res.data[m].tagid) // tags.push([res.data[m].articleid]) @@ -24,10 +25,22 @@ var articlefind = async (ctx, next) => { } } - console.log(tags) + // console.log(tags) } + await dbs.find("label").then((res)=>{ + for(let i in articlelist){ + for(let m in articlelist[i].tag){ + console.log(articlelist[i].tag[m]) + for(let n in res.data){ + if(res.data[n].num_key==articlelist[i].tag[m]){ + articlelist[i].tag[m]=res.data[n].lablename + } + } + } + } + }) }) ctx.body=articlelist