Browse Source

(*)将年月拼接返回给前端

master
Archer_cdm 2 years ago
parent
commit
6069793553
  1. 10
      api/app/lib/controllers/report/index.js

10
api/app/lib/controllers/report/index.js

@ -9,8 +9,16 @@ async function getReserveItemReport(ctx, next) {
order: [['year', 'DESC'], ['month', 'DESC']], order: [['year', 'DESC'], ['month', 'DESC']],
where: { type: type } where: { type: type }
}) })
let newReportData = rslt.map(e => {
return {
id: e.id,
date: e.year + '-' + e.month,
path: e.path,
type: e.type
}
})
ctx.status = 200 ctx.status = 200
ctx.body = rslt ctx.body = newReportData
} catch (error) { } catch (error) {
ctx.fs.logger.error(`path:${ctx.path},error:${error}`) ctx.fs.logger.error(`path:${ctx.path},error:${error}`)
ctx.status = 400; ctx.status = 400;

Loading…
Cancel
Save