文章查询
This commit is contained in:
parent
178bb9fc71
commit
998b86f8e3
@ -2,14 +2,40 @@
|
||||
// 获取文章列表
|
||||
var articlefind = async (ctx, next) => {
|
||||
let articlelist;
|
||||
await dbs.find("articlelists").then((res) => {
|
||||
let tags=[]
|
||||
await dbs.find("articlelists").then(async (res) => {
|
||||
let num=0
|
||||
articlelist = res.data
|
||||
await dbs.find("articletag").then((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)
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
ctx.body=articlelist
|
||||
})
|
||||
next()
|
||||
}
|
||||
// 添加文章
|
||||
// 参数: title 文章标题, content 文章内容 tag 选择的标签id 形式: 1,2
|
||||
// 参数: title 文章标题, content 文章内容 tags 选择的标签id 形式: 1,2
|
||||
var articleadd = async (ctx, next) => {
|
||||
let articleid=0
|
||||
let month=parseInt(new Date(Date.now()).getMonth())+1
|
||||
|
Loading…
Reference in New Issue
Block a user