diff --git a/controllers/index.js b/controllers/index.js index e119933..6525c76 100644 --- a/controllers/index.js +++ b/controllers/index.js @@ -53,12 +53,29 @@ var dellist = async (ctx,next)=>{ ctx.body = JSON.stringify(res) }) } - +} +var findlist = async (ctx,next)=>{ + // console.log(ctx.query.id) + if(ctx.query.name == undefined){ + ctx.body = JSON.stringify({ + code : 1, + msg:"id不能为空" + }) + }else{ + await dbs.find('list',{ + "name":ctx.query.name + }).then((res)=>{ + ctx.body = JSON.stringify(res) + }).catch((err)=>{ + ctx.body = JSON.stringify(res) + }) + } } module.exports = { 'GET /getlist':getlist, 'POST /addlist':addlist, 'GET /getaddlist':getaddlist, - 'GET /dellist' : dellist + 'GET /dellist' : dellist, + 'GET /findlsit':findlist }