Browse Source

优化一下可读性

dev
巴林闲侠 1 year ago
parent
commit
4171254623
  1. 6
      api/app/lib/controllers/overview/operation.js

6
api/app/lib/controllers/overview/operation.js

@ -153,7 +153,11 @@ async function busRunRealTime (ctx) {
let now = moment() let now = moment()
let hourBefour = now.subtract(1, 'h') let hourBefour = now.subtract(1, 'h')
ctx.status = 200; ctx.status = 200;
ctx.body = (busRunRes || []).filter(b => b.runState == 1 && moment(b.siteTime).isAfter(hourBefour) && busCarRes.some(bc => bc.vehicleLicensePlateNumber == b.busNoChar)) ctx.body = (busRunRes || []).filter(b => {
return b.runState == 1
&& moment(b.siteTime).isAfter(hourBefour)
&& busCarRes.some(bc => bc.vehicleLicensePlateNumber == b.busNoChar)
})
} 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