修复了不能删除订单的bug

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

@ -18,3 +18,13 @@ module.exports.updateExpressDao = async function (expData) {
}) })
return handleArrayDaoData(await expressModel.findAll()) 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 { const {
getExpressServices, getExpressServices,
addExpressServices, addExpressServices,
updateExpressServices updateExpressServices,
deleteExpressServices
} = require("../services/expressService") } = require("../services/expressService")
const { const {
formatResponse formatResponse
@ -24,4 +25,9 @@ router.put("/", async function (req, res, next) {
res.send(formatResponse(0, "", data)) 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 module.exports = router

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