fix 无法修改配置文件

This commit is contained in:
2023-08-03 21:09:57 +08:00
parent e4151b94ed
commit da5dd7ebf9
3 changed files with 21 additions and 27 deletions

View File

@@ -20,26 +20,20 @@ router.get('/getConfig', async (ctx) => {
/**
* 设置配置文件接口
*/
router.post('/setConfig', async (ctx) => {
let body = ctx.request.body;
console.info(body)
// if (body === "") {
// ctx.body = {
// code: -1,
// msg: "提交内容不能为空"
// }
// return
// }
//
// let b = config.setConfig(body);
// console.info(b)
// ctx.body = {
// code: b ? 0 : -1,
// msg: b ? 'ok' : "error",
// data: null
// }
router.post('/setConfig', async (req, res) => {
if (req.request.body === undefined) {
req.body = {
code: -1,
msg: "提交内容不能为空"
}
return
}
let b = config.setConfig(req.request.body);
req.body = {
code: b ? 0 : -2,
msg: b ? 'ok' : "error",
}
})
module.exports = router
module.exports = router