Browse Source

增加配置

liuyu 5 years ago
parent
commit
d0f537222e
5 changed files with 93 additions and 42 deletions
  1. 1 1
      app/service/bedroom.js
  2. 20 20
      config/config.default.js
  3. 21 21
      config/config.local.js
  4. 34 0
      config/config.prod.js
  5. 17 0
      ecosystem.config.js

+ 1 - 1
app/service/bedroom.js

@@ -31,7 +31,7 @@ class BedroomService extends CrudService {
     // 根据批次id查询批次信息
     const _batch = term.batchnum.find(p => p.id === batchid);
     // 查询所有寝室列表
-    const bedroomList = await this.model.find({ batch: _batch.batch }).sort({ floor: -1 });
+    const bedroomList = await this.model.find({ batch: _batch.batch, status: '0' }).sort({ floor: -1 });
     // 循环所有当前批次下的寝室列表进行分寝处理
     const studentList = await this.getstudents(termid, batchid);
     console.log('stulen-->' + studentList.length);

+ 20 - 20
config/config.default.js

@@ -59,27 +59,27 @@ module.exports = appInfo => {
   config.user_email = '1345526645@qq.com';
   config.auth_code = 'vnrzrxwserhyfeda';
 
-  // // mq配置
-  // config.amqp = {
-  //   client: {
-  //     hostname: '127.0.0.1',
-  //     username: 'visit',
-  //     password: 'visit',
-  //     vhost: 'train',
-  //   },
-  //   app: true,
-  //   agent: true,
-  // };
+  // mq配置
+  config.amqp = {
+    client: {
+      hostname: '127.0.0.1',
+      username: 'visit',
+      password: 'visit',
+      vhost: 'train',
+    },
+    app: true,
+    agent: true,
+  };
 
-  // // redis config
-  // config.redis = {
-  //   client: {
-  //     port: 6379, // Redis port
-  //     host: '127.0.0.1', // Redis host
-  //     password: 123456,
-  //     db: 0,
-  //   },
-  // };
+  // redis config
+  config.redis = {
+    client: {
+      port: 6379, // Redis port
+      host: '127.0.0.1', // Redis host
+      password: 123456,
+      db: 0,
+    },
+  };
 
   // mongoose config
   config.mongoose = {

+ 21 - 21
config/config.local.js

@@ -22,27 +22,27 @@ module.exports = () => {
   // 认证回调地址
   config.authUrl = '/api/auth';
 
-  // // mq config
-  // config.amqp = {
-  //   client: {
-  //     hostname: '127.0.0.1',
-  //     username: 'wy',
-  //     password: '1',
-  //     vhost: 'smart',
-  //   },
-  //   app: true,
-  //   agent: true,
-  // };
-
-  // // redis config
-  // config.redis = {
-  //   client: {
-  //     port: 6379, // Redis port
-  //     host: '127.0.0.1', // Redis host
-  //     password: null,
-  //     db: 0,
-  //   },
-  // };
+  // mq config
+  config.amqp = {
+    client: {
+      hostname: '127.0.0.1',
+      username: 'wy',
+      password: '1',
+      vhost: 'smart',
+    },
+    app: true,
+    agent: true,
+  };
+
+  // redis config
+  config.redis = {
+    client: {
+      port: 6379, // Redis port
+      host: '127.0.0.1', // Redis host
+      password: null,
+      db: 0,
+    },
+  };
 
   config.mongoose = {
     url: 'mongodb://localhost:27017/train',

+ 34 - 0
config/config.prod.js

@@ -8,5 +8,39 @@ module.exports = () => {
     // consoleLevel: 'DEBUG',
   };
 
+  // mongoose config
+  config.mongoose = {
+    url: 'mongodb://127.0.0.1:27017/train',
+    options: {
+      user: 'admin',
+      pass: 'admin',
+      authSource: 'admin',
+      useNewUrlParser: true,
+      useCreateIndex: true,
+    },
+  };
+
+  // mq配置
+  config.amqp = {
+    client: {
+      hostname: '127.0.0.1',
+      username: 'visit',
+      password: 'visit',
+      vhost: 'train',
+    },
+    app: true,
+    agent: true,
+  };
+
+  // redis config
+  config.redis = {
+    client: {
+      port: 6379, // Redis port
+      host: '127.0.0.1', // Redis host
+      password: 123456,
+      db: 0,
+    },
+  };
+
   return config;
 };

+ 17 - 0
ecosystem.config.js

@@ -0,0 +1,17 @@
+'use strict';
+
+const app = 'service-center';
+module.exports = {
+  apps: [{
+    name: app, // 应用名称
+    script: './server.js', // 实际启动脚本
+    out: `./logs/${app}.log`,
+    error: `./logs/${app}.err`,
+    watch: [ // 监控变化的目录,一旦变化,自动重启
+      'app', 'config',
+    ],
+    env: {
+      NODE_ENV: 'production', // 环境参数,当前指定为生产环境
+    },
+  }],
+};