明树Git Lab

Commit ac4ef43f authored by zengfanpei's avatar zengfanpei

update

parent d21cf64a
......@@ -35,68 +35,68 @@ async function init(req, res) {
await DB.CollectAttribute.findOneAndUpdate({ dbKey: element.dbKey }, element, { upsert: true });
}
// 土壤
for (let index = 0; index < 20; index++) {
await DB.CollectSMC.findOneAndUpdate({ time: moment('2024-08-26').add(index, 'day') }, {
id: 8746,
name: "设备名称修改测试",
deviceNumber: "16A67205BA3A",
time: moment('2024-08-26').add(index, 'day'),
soilTemperature: 11 + Math.floor(Math.random() * 20),
soilMoisture: 11 + Math.floor(Math.random() * 20),
nitrogen: 11 + Math.floor(Math.random() * 20),
phosphorus: 11 + Math.floor(Math.random() * 20),
potassium: 11 + Math.floor(Math.random() * 20),
soilPH: 11 + Math.floor(Math.random() * 20),
soilConductivity: 11 + Math.floor(Math.random() * 20),
}, { upsert: true })
}
// // 土壤
// for (let index = 0; index < 20; index++) {
// await DB.CollectSMC.findOneAndUpdate({ time: moment('2024-08-26').add(index, 'day') }, {
// id: 8746,
// name: "设备名称修改测试",
// deviceNumber: "16A67205BA3A",
// time: moment('2024-08-26').add(index, 'day'),
// soilTemperature: 11 + Math.floor(Math.random() * 20),
// soilMoisture: 11 + Math.floor(Math.random() * 20),
// nitrogen: 11 + Math.floor(Math.random() * 20),
// phosphorus: 11 + Math.floor(Math.random() * 20),
// potassium: 11 + Math.floor(Math.random() * 20),
// soilPH: 11 + Math.floor(Math.random() * 20),
// soilConductivity: 11 + Math.floor(Math.random() * 20),
// }, { upsert: true })
// }
//气象
for (let index = 0; index < 20; index++) {
await DB.CollectWS.findOneAndUpdate({ time: moment('2024-08-26').add(index, 'day') }, {
id: 8746,
name: "气象站",
deviceNumber: "1111111111111",
time: moment('2024-08-26').add(index, 'day'),
windSpeed: 11 + Math.floor(Math.random() * 20),
windDirection: 11 + Math.floor(Math.random() * 20),
rainfall: 11 + Math.floor(Math.random() * 20),
}, { upsert: true })
}
// for (let index = 0; index < 20; index++) {
// await DB.CollectWS.findOneAndUpdate({ time: moment('2024-08-26').add(index, 'day') }, {
// id: 8746,
// name: "气象站",
// deviceNumber: "1111111111111",
// time: moment('2024-08-26').add(index, 'day'),
// windSpeed: 11 + Math.floor(Math.random() * 20),
// windDirection: 11 + Math.floor(Math.random() * 20),
// rainfall: 11 + Math.floor(Math.random() * 20),
// }, { upsert: true })
// }
// 虫情
for (let index = 0; index < 20; index++) {
let dataId = new mongoose.Types.ObjectId()
let data = await DB.CollectIPS.create({
_id: dataId,
id: 8746,
name: "虫情系统",
deviceNumber: "FF35d4072d53",
time: moment('2024-08-26').add(index, 'day'),
downloadUrl: "pictures/FF35D4072D53/2024-08-20-15-03-43.jpg",
newTime: moment('2024-08-26').add(index, 'day'),
newCount: 11 + Math.floor(Math.random() * 20)
});
let typeId = new mongoose.Types.ObjectId()
let type = await DB.CollectIPSType.create({ _id: typeId, name: "虫子" + index });
let planId = new mongoose.Types.ObjectId()
let plan = await DB.CollectIPSPlan.create({ _id: planId, name: "虫子" + index, controlPlan: "防治建议" + index });
await DB.CollectIPSResult.findOneAndUpdate({ data: dataId }, {
deviceNumber: "FF35d4072d53",
name: "虫子" + index,
count: 1 + Math.floor(Math.random() * 10),
time: moment('2024-08-26').add(index, 'day'),
type: typeId,
plan: planId,
data: dataId,
}, { upsert: true });
}
// for (let index = 0; index < 20; index++) {
// let dataId = new mongoose.Types.ObjectId()
// let data = await DB.CollectIPS.create({
// _id: dataId,
// id: 8746,
// name: "虫情系统",
// deviceNumber: "FF35d4072d53",
// time: moment('2024-08-26').add(index, 'day'),
// downloadUrl: "pictures/FF35D4072D53/2024-08-20-15-03-43.jpg",
// newTime: moment('2024-08-26').add(index, 'day'),
// newCount: 11 + Math.floor(Math.random() * 20)
// });
// let typeId = new mongoose.Types.ObjectId()
// let type = await DB.CollectIPSType.create({ _id: typeId, name: "虫子" + index });
// let planId = new mongoose.Types.ObjectId()
// let plan = await DB.CollectIPSPlan.create({ _id: planId, name: "虫子" + index, controlPlan: "防治建议" + index });
// await DB.CollectIPSResult.findOneAndUpdate({ data: dataId }, {
// deviceNumber: "FF35d4072d53",
// name: "虫子" + index,
// count: 1 + Math.floor(Math.random() * 10),
// time: moment('2024-08-26').add(index, 'day'),
// type: typeId,
// plan: planId,
// data: dataId,
// }, { upsert: true });
// }
res.sendData({})
}
......
......@@ -13,6 +13,7 @@ module.exports = {
},
env_production: {
NODE_ENV: "production",
PORT:3000
},
log_date_format: "YYYY-MM-DD HH:mm:ss",
out_file: `/srv/letian/logs/${curDateStr}.log`,
......
......@@ -76,5 +76,5 @@ app.use(function (err, req, res, next) {
const server = require('http').createServer(app);
server.listen(process.env.PORT || 3000, function () {
console.log(`****** server is listening : ${process.env.PORT}`);
console.log(`****** server is listening : ${process.env.PORT} || 3000`);
});
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