From ea74c739f68696a74107bfbadc70d39e6ac1db44 Mon Sep 17 00:00:00 2001 From: asd <374367073@qq.com> Date: Fri, 6 Dec 2019 09:10:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=A0=87=E7=AD=BE111?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/article.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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