明树Git Lab

Commit ac4ef43f authored by zengfanpei's avatar zengfanpei

update

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