router.get('/test', function(req, res, next) {
sqlQuery("select * from userinfo", (data) => {
let type2num = {}
data.forEach(({ id, type, num }) => {
if (type2num[type])
type2num[type] += num
else
type2num[type] = num
})
res.send({
code: "200",
message: "查询成功",
data,
type2num,
});
});
});
一段代码爱上express
最新推荐文章于 2021-12-28 11:01:00 发布