This commit is contained in:
asd 2019-12-02 17:40:01 +08:00
commit 7f2fc7b58d
3 changed files with 35 additions and 16 deletions

View File

@ -36,8 +36,8 @@ var articleupdate=async (ctx,next)=>{
// console.log(new Date(Date.now()).getDate()) // console.log(new Date(Date.now()).getDate())
} }
module.exports = { module.exports = {
'GET /articleadd': articleadd, 'POST /articleadd': articleadd,
'GET /articlefind': articlefind, 'GET /articlefind': articlefind,
'GET /articledel': articledel, 'GET /articledel': articledel,
'GET /articleupdate': articleupdate 'POST /articleupdate': articleupdate
}; };

View File

@ -4,12 +4,14 @@
var groupadd = async (ctx, next) => { var groupadd = async (ctx, next) => {
await dbs.add("group", { groupname: ctx.query.groupname, fuid: ctx.query.fuid == null ? '0' : ctx.query.fuid }) await dbs.add("group", { groupname: ctx.query.groupname, fuid: ctx.query.fuid == null ? '0' : ctx.query.fuid })
ctx.body = "添加成功" ctx.body = "添加成功"
next()
} }
// 删除分组 // 删除分组
// num_key 操作使用的id // num_key 操作使用的id
var groupdel = async (ctx, next) => { var groupdel = async (ctx, next) => {
await dbs.remove("group", { num_key: parseInt(ctx.query.key) }) await dbs.remove("group", { num_key: parseInt(ctx.query.key) })
ctx.body = "删除成功" ctx.body = "删除成功"
next()
} }
// 获取分组 // 获取分组
var groupfind = async (ctx, next) => { var groupfind = async (ctx, next) => {

View File

@ -1,17 +1,34 @@
// 获取标签 // 获取标签
var getlabel = async (ctx, next) => { var getlabel = async (ctx, next) => {
await dbs.find("label").then((res) => { await dbs.find('label').then((res) => {
console.log(res) ctx.body = JSON.stringify(res)
})
}
var addlabel = async (ctx, next) => {
//lablename 标签名
if(ctx.query.lablename != null){
await dbs.add("label",{lablename:ctx.query.lablename}).then((res)=>{
if(res.code == 0){
ctx.body="{code:0,msg:'添加成功'}"
}else{
ctx.body="{code:1,msg:'添加失败'}"
}
}) })
}else{
ctx.body="{code:1,msg:'添加失败'}"
} }
next()
//添加标签 }
var addlabel=async(ctx,next)=>{ var dellabel = async (ctx, next) => {
await dbs.add("label", {labelname:ctx.query.labelname}) await dbs.remove("group", { num_key: parseInt(ctx.query.key) })
ctx.body = "添加成功" ctx.body = "删除成功"
next()
} }
module.exports = { module.exports = {
'GET /addlabel': addlabel,
'GET /getlabel':getlabel, 'GET /getlabel':getlabel,
}; 'GET /addlabel':addlabel,
'GET /dellabel':dellabel
}