| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 | 
							- /**
 
-  * Created by Tony on 2017/3/9.
 
-  */
 
- var mg = require('mongoose');
 
- //var Promise = require('bluebird');
 
- mg.Promise = require('bluebird');
 
- //mg.connect('mongodb://localhost/Demo');
 
- module.exports = {
 
-     getConnection : function(server, port, dbName) {
 
-         //*/
 
-         var dbURL = 'mongodb://' + server + ":" + port + '/' + dbName;
 
-         return mg.createConnection(dbURL);
 
-         /*/
 
-         if (port) {
 
-             mg.connect('mongodb://' + server + ":" + port + '/' + dbName);
 
-         } else {
 
-             mg.connect('mongodb://' + server + '/' + dbName);
 
-         }
 
-         return mg;
 
-         //*/
 
-     },
 
-     getQAConnection: function(dbName) {
 
-         //*/
 
-         return mg.createConnection("mongodb://192.168.1.184:60666/" + dbName);
 
-         /*/
 
-         mg.connect('mongodb://192.168.1.184:60666/' + dbName);
 
-         return mg;
 
-         //*/
 
-     },
 
-     getLocalConnection: function(dbName) {
 
-         //*/
 
-         return mg.createConnection("mongodb://localhost/" + dbName);
 
-         /*/
 
-         mg.connect('mongodb://localhost:27017/' + dbName);
 
-         return mg;
 
-         //*/
 
-     },
 
-     getCfgConnection: function(dbName) {
 
-         var config = require("../config.js");
 
-         //*/
 
-         var port = config.current.port;
 
-         var dbURL = 'mongodb://' + config.current.server + ":" + config.current.port + '/' + dbName;
 
-         return mg.createConnection(dbURL);
 
-         /*/
 
-         mg.connect('mongodb://' + config.current.server + ":" + config.current.port + '/' + dbName);
 
-         return mg;
 
-         //*/
 
-     },
 
-     connect:function () {
 
-         var config = require("../config.js");
 
-         var dbURL = 'mongodb://' + config.current.server + ":" + config.current.port + '/scConstruct';
 
-         mg.connect(dbURL, config.options);
 
-         var db = mg.connection;
 
-         db.on("error",function (err) {
 
-             console.log('Could not connect to MongoDB!');
 
-             console.log(err);
 
-             process.exit(-1);
 
-         })
 
-         return mg;
 
-     }
 
- };
 
 
  |