明树Git Lab

Commit 7556290b authored by zfp1's avatar zfp1

update

parent 52901400
......@@ -48,13 +48,14 @@ async function updateDeepPlant(req, res, next) {
if(!req.body._id) {
return res.sendError(errorMessage.resourceNotFound);
}
let body = req.body;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
let upInfo = {
...req.body,
...body,
_id: undefined,
}
let ret = await DB.ProductDeep.findOneAndUpdate({_id: req.body._id}, upInfo);
......
......@@ -49,13 +49,14 @@ async function updateDirectPlant(req, res, next) {
if(!req.body._id) {
return res.sendError(errorMessage.resourceNotFound);
}
let body = req.body;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
let upInfo = {
...req.body,
...body,
_id: undefined,
}
let ret = await DB.ProductPlant.findOneAndUpdate({_id: req.body._id}, upInfo);
......
......@@ -49,13 +49,14 @@ async function updatePrePlant(req, res, next) {
if(!req.body._id) {
return res.sendError(errorMessage.resourceNotFound);
}
let body = req.body;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
let upInfo = {
...req.body,
...body,
_id: undefined,
}
let ret = await DB.ProductPre.findOneAndUpdate({_id: req.body._id}, upInfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment