// 获取标签 var getlabel = async (ctx, next) => { await dbs.find('label').then((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 dellabel = async (ctx, next) => { await dbs.remove("group", { num_key: parseInt(ctx.query.key) }) ctx.body = "删除成功" next() } module.exports = { 'GET /getlabel':getlabel, 'GET /addlabel':addlabel, 'GET /dellabel':dellabel }