API的body部分(Patch方式)
{
"statusOfOrder": "processing",
"pharmacist": "5be904255b450d6f20d74fc3"
}
管理端更新函数部分
const _ = require('lodash');
// order = _.merge(order, req.body); // 不应该使用merge。1.因为有漏洞(例如API的body部分添加其它字段,也会同时更新);2.在后端查看时,不打出log的话无法查看更新了哪些字段,不利于排错。
// 替换为下列写法
order.statusOfOrder = req.body.statusOfOrder;
order.pharmacist = req.body.pharmacist;