明树Git Lab

Commit 8e50bb6f authored by zfp1's avatar zfp1

update

parent 2e09eec3
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
async function findCompInfo(req, res, next) { async function findCompInfo(req, res, next) {
try { try {
let ret = await DB.CompanyInfo.findOne({}).populate({path: "companyInfoImgs"}).populate({path: "qualiCertiImgs"}).populate({path: "addressInfo.img"}).lean().exec(); let ret = await DB.CompanyInfo.findOne({}).populate({path: "companyInfoImgs"}).populate({path: "qualiCertiImgs"}).populate({path: "addressInfo.img"}).populate({ path: "gcImg" }).populate({ path: "jdImg" }).lean().exec();
return res.sendData(ret); return res.sendData(ret);
} catch (error) { } catch (error) {
next(error); next(error);
......
...@@ -47,7 +47,7 @@ async function listTraceCode(req, res, next) { ...@@ -47,7 +47,7 @@ async function listTraceCode(req, res, next) {
search.batchNumber = { $regex: req.body.batchNumber } search.batchNumber = { $regex: req.body.batchNumber }
} }
const count = await DB.ProTraceCode.countDocuments(search); const count = await DB.ProTraceCode.countDocuments(search);
let list = await DB.ProTraceCode.find(search).sort({ _id: -1 }).skip(skip).limit(pageSize).populate({path: "rawMatCul.proSteps.img"}).populate({path: "proProcess.proSteps.img"}).populate({path: "jdImg"}).populate({path: "gcImg"}).lean(); let list = await DB.ProTraceCode.find(search).sort({ _id: -1 }).skip(skip).limit(pageSize).populate({path: "rawMatCul.proSteps.img"}).populate({path: "proProcess.proSteps.img"}).lean();
let ret = []; let ret = [];
for (let index = 0; index < list.length; index++) { for (let index = 0; index < list.length; index++) {
const element = list[index]; const element = list[index];
...@@ -189,7 +189,7 @@ async function getJiankong(req, res, next) { ...@@ -189,7 +189,7 @@ async function getJiankong(req, res, next) {
if (!req.body._id) { if (!req.body._id) {
return res.sendError(errorMessage.resourceNotFound); return res.sendError(errorMessage.resourceNotFound);
} }
let traccode = await DB.ProTraceCode.findOne({ _id: req.body._id }, { type: 1, source: 1, _id: 1, jdImg: 1, gcImg: 1, agrOnOff: 1, indEnvOnOff: 1 }).populate({ path: "gcImg" }).populate({ path: "jdImg" }).lean(); let traccode = await DB.ProTraceCode.findOne({ _id: req.body._id }, { type: 1, source: 1, _id: 1, agrOnOff: 1, indEnvOnOff: 1 }).lean();
if (!(traccode && traccode._id && traccode.source)) { if (!(traccode && traccode._id && traccode.source)) {
return res.sendError(errorMessage.resourceNotFound); return res.sendError(errorMessage.resourceNotFound);
} }
...@@ -220,7 +220,9 @@ async function getJiankong(req, res, next) { ...@@ -220,7 +220,9 @@ async function getJiankong(req, res, next) {
// 工业环境 // 工业环境
} }
let companyInfo = await DB.CompanyInfo.findOne({}, {gcImg: 1, jdImg:1}).populate({ path: "gcImg" }).populate({ path: "jdImg" });
traccode.gcImg = companyInfo.gcImg;
traccode.jdImg = companyInfo.jdImg;
traccode.source = source; traccode.source = source;
res.sendData(traccode); res.sendData(traccode);
} catch (error) { } catch (error) {
......
...@@ -16,6 +16,14 @@ const letianCompanyInfoSchema = new Schema({ ...@@ -16,6 +16,14 @@ const letianCompanyInfoSchema = new Schema({
type: String, type: String,
comment: "简介" comment: "简介"
}, },
jdImg: { // 基地总览图片
type: mongoose.Types.ObjectId,
ref: 'File',
},
gcImg: { //工厂总览图
type: mongoose.Types.ObjectId,
ref: 'File',
},
companyInfoImgs: [ companyInfoImgs: [
{ {
type: mongoose.Types.ObjectId, type: mongoose.Types.ObjectId,
......
...@@ -11,14 +11,6 @@ const letianProTraceCodeSchema = new Schema({ ...@@ -11,14 +11,6 @@ const letianProTraceCodeSchema = new Schema({
// comment: "产品名称" // comment: "产品名称"
// }, // },
tcode: String, // 溯源码 tcode: String, // 溯源码
jdImg: { // 基地总览图片
type: mongoose.Types.ObjectId,
ref: 'File',
},
gcImg: { //工厂总览图
type: mongoose.Types.ObjectId,
ref: 'File',
},
type: { type: {
type: Number, type: Number,
comment: "1 种植农产品 2 轻加工 3 深加工" comment: "1 种植农产品 2 轻加工 3 深加工"
......
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