Merge branch 'zj' of pplokijuhyg/blog-server into master
This commit is contained in:
commit
cef9f36a0f
@ -2,14 +2,53 @@
|
|||||||
// 获取文章列表
|
// 获取文章列表
|
||||||
var articlefind = async (ctx, next) => {
|
var articlefind = async (ctx, next) => {
|
||||||
let articlelist;
|
let articlelist;
|
||||||
await dbs.find("articlelists").then((res) => {
|
let tags=[]
|
||||||
|
await dbs.find("articlelists").then(async (res) => {
|
||||||
|
let num=0
|
||||||
articlelist = res.data
|
articlelist = res.data
|
||||||
|
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)
|
||||||
|
// console.log(res.data[m].articleid,res.data[m].tagid)
|
||||||
|
// tags.push([res.data[m].articleid])
|
||||||
|
tags.push(res.data[m].tagid)
|
||||||
|
articlelist[i].tag=tags
|
||||||
|
|
||||||
|
}else{
|
||||||
|
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
|
ctx.body=articlelist
|
||||||
})
|
})
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
// 添加文章
|
// 添加文章
|
||||||
// 参数: title 文章标题, content 文章内容 tag 选择的标签id 形式: 1,2
|
// 参数: title 文章标题, content 文章内容 tags 选择的标签id 形式: 1,2
|
||||||
var articleadd = async (ctx, next) => {
|
var articleadd = async (ctx, next) => {
|
||||||
let articleid=0
|
let articleid=0
|
||||||
let month=parseInt(new Date(Date.now()).getMonth())+1
|
let month=parseInt(new Date(Date.now()).getMonth())+1
|
||||||
|
Loading…
Reference in New Issue
Block a user