Commit e571b425 authored by wty's avatar wty

上线test9

parent aa36d917
......@@ -39,15 +39,21 @@ getMysql.then(Mysql => {
})
router.get('/queryTypeForManage', async (req, res) => {
const SQL1 = 'SELECT * FROM type'
const SQL2 = 'SELECT * FROM child_type'
const typeArr = await query(SQL1)
const childTypeArr = await query(SQL2)
const data = typeArr.map(v =>({...v, children: childTypeArr.filter(_v => _v.type_id === v.type_id)}))
res.send({
success: true,
data: data
})
try {
const SQL1 = 'SELECT * FROM type'
const SQL2 = 'SELECT * FROM child_type'
const typeArr = await query(SQL1)
const childTypeArr = await query(SQL2)
const data = typeArr.map(v => ({...v, children: childTypeArr.filter(_v => _v.type_id === v.type_id)}))
res.send({
success: true,
data: data
})
} catch (e) {
console.error(e)
res.send({success: false, err: e})
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment