Browse Source

fix 车辆删除

release_0.0.4
巴林闲侠 2 years ago
parent
commit
36d33f166b
  1. 6
      api/app/lib/controllers/data/vehicle.js
  2. 9
      api/log/development.log

6
api/app/lib/controllers/data/vehicle.js

@ -115,9 +115,9 @@ async function specificEdit (ctx) {
const data = ctx.request.body;
if (!data.vehicleId) {
const vehicleRes = await models.Vehicle.create(data)
const vehicleRes = await models.MunicipalVehicle.create(data)
} else {
const vehicleRes = await models.Vehicle.update(data, {
const vehicleRes = await models.MunicipalVehicle.update(data, {
where: {
id: data.vehicleId
}
@ -139,7 +139,7 @@ async function specificDel (ctx) {
const models = ctx.fs.dc.models;
const { vehicleId } = ctx.params;
const vehicleRes = await models.Vehicle.destroy({
const vehicleRes = await models.MunicipalVehicle.destroy({
where: {
id: vehicleId
}

9
api/log/development.log

@ -9999,3 +9999,12 @@
2022-07-27 14:42:45.566 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-27 14:42:45.566 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-27 14:42:48.376 - error: path: /data/export, error: ReferenceError: fs is not defined
2022-07-27 15:29:53.136 - debug: [FS-LOGGER] Init.
2022-07-27 15:29:53.285 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-27 15:29:53.285 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-27 15:47:39.653 - error: path: /vehicle/1/specific, error: TypeError: Cannot read property 'destroy' of undefined
2022-07-27 15:47:55.412 - error: path: /vehicle/1/specific, error: TypeError: Cannot read property 'destroy' of undefined
2022-07-27 15:48:01.737 - error: path: /vehicle/4/specific, error: TypeError: Cannot read property 'destroy' of undefined
2022-07-27 15:49:28.071 - error: path: /vehicle/3/specific, error: TypeError: Cannot read property 'destroy' of undefined
2022-07-27 15:50:36.847 - error: path: /vehicle/3/specific, error: TypeError: Cannot read property 'destroy' of undefined
2022-07-27 15:51:05.608 - error: path: /vehicle/3/specific, error: TypeError: Cannot read property 'destroy' of undefined

Loading…
Cancel
Save