diff --git a/routes/container.js b/routes/container.js index 60673ea..90cf978 100644 --- a/routes/container.js +++ b/routes/container.js @@ -20,6 +20,34 @@ router.get('/', async (ctx, next) => { message: '获取内容成功' } }) +router.get('/getPage', async (ctx, next) => { + const arg = ctx.request.query + if (!Object.keys(arg).includes('route')) { + ctx.body = { + data: {}, + state: false, + message: '缺少Route' + } + return + } + const [oldRows, oldFields] = await global.SQL.execute('SELECT * FROM `menu` WHERE `isdelete` = 0 AND `route` = ?', [arg.route]); + console.log(oldRows) + if(oldRows.length == 0){ + ctx.body = { + data: {}, + state: false, + message: '未找到页面' + } + return + } + const [rows, fields] = await global.SQL.execute('SELECT * FROM `container` WHERE `isdelete` = 0 AND `menuId` = ?', [oldRows[0].id]); + ctx.body = { + data: rows, + state: true, + message: '获取内容成功' + } +}) + router.delete('/', async (ctx, next) => { const arg = ctx.request.query console.log(arg)