fix 无法修改配置文件
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user