修复了不能删除订单的bug

master
P-Jhao 2 days ago
parent e486b6e4c4
commit 3f08060659

@ -18,3 +18,13 @@ module.exports.updateExpressDao = async function (expData) {
})
return handleArrayDaoData(await expressModel.findAll())
}
module.exports.deleteExpressDao = async function (id) {
console.log(id, "deleteId")
await expressModel.destroy({
where: {
id
}
})
return handleArrayDaoData(await expressModel.findAll())
}

@ -3,7 +3,8 @@ const router = express.Router()
const {
getExpressServices,
addExpressServices,
updateExpressServices
updateExpressServices,
deleteExpressServices
} = require("../services/expressService")
const {
formatResponse
@ -24,4 +25,9 @@ router.put("/", async function (req, res, next) {
res.send(formatResponse(0, "", data))
})
router.delete("/", async function (req, res, next) {
const data = await deleteExpressServices(req.body)
res.send(formatResponse(0, "", data))
})
module.exports = router

@ -1,7 +1,8 @@
const {
getExpressDao,
addExpressDao,
updateExpressDao
updateExpressDao,
deleteExpressDao
} = require("../dao/expressDao")
const {
getRandomExpressId
@ -24,3 +25,11 @@ module.exports.updateExpressServices = async function (expData) {
//这里需要提供id
return await updateExpressDao(expData)
}
module.exports.deleteExpressServices = async function ({
id
}) {
return await deleteExpressDao(
id
)
}
Loading…
Cancel
Save