This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by Linyuning on 2018/4/10. | |
*/ | |
var MysqlDB = require("../db/MysqlDB.js"); | |
var mysqldb = new MysqlDB(config.mysqlDatabase); | |
var commonUtil = require("../utils/commonUtil.js"); | |
var sqlUtil = require("../utils/sqlUtil.js"); | |
var bidPlanSQLServer = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//then 中 是可以把返回值 当做promise 包装的 | |
//但是在new promise 中 是没有这个能力的 return 只会导致跳出函数 promise 的状态永远不会被设定 | |
//无论return 与否 链式的then 都会一直往下走 找下一个then | |
//catch 后 如果什么都没有 也会一直依次的走then 下去 | |
//return function 直接不执行了 就等你调用 函数的参数 只能写名字 不能写一个函数实现了 最多写函数变量名 | |
//return promise 则提供一个函数作为参数 这个参数不是外面给的 而是自己用的 | |
//resolve 后 还是会执行promise里的语句的 | |
//一旦resolve 或者reject 后 promise 状态就不再变化了 | |
//promise 里的代码实际上是在调用promise时候同步执行的 一直执行到resolve 或是reject 以后, | |
//也还是会继续同步执行,一直到末尾或者遇到return 除非有代码是异步的 不然里面的代码实际上是同步的 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var options = { | |
method: 'post', | |
url: "http://127.0.0.1:2000/publicInterface/login", | |
form: {userName:"admin",password : 123456}, | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded' | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (req.method == "GET") { | |
req.headers["token"] = tokenTemp.toString(); | |
}else{ | |
req.body.token = tokenTemp.toString(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deepCopyObjt(argument) { | |
if (typeof argument != "object") return argument; | |
var newObjt = {}; | |
for (attr in argument){ | |
newObjt[attr] = deepCopyObjt(argument[attr]); | |
} | |
return newObjt; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlUtil.generateUpdateSql(BID_ISSUE_TABLE_NAME, { | |
code : params.code, | |
bidCode:"", | |
}, {code : params.code }).then(function (option) { | |
return mysqldb.execute(option.sql, option.sql_param).then(resolve).catch(function (error) { | |
// console.log("sql error " +error); | |
reject(error); | |
}) | |
}).catch(reject); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sqlString = "DELETE FROM " + _tableName +" WHERE code=?"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.then(function () { | |
return Promise.all(bidWindSegsObjcToDeal.inserts.map(function (currentBidWinSeg) { | |
return bidSegSQLServer.addBidWinSegMycWrapper(currentBidWinSeg); | |
})); | |
}).then(function (bidWinSegCodes) { | |
//增加分标段成功 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by myc on 2018/4/16. | |
*/ | |
var express = require('express'); | |
var managerBidBackAndIssue = express.Router(); | |
var bidBackAndIssueSQLServer = require('../server/BidBackAndIssueSQLServer.js'); | |
var bidQKLServer = require('../server/BidQKLServer.js'); | |
var bidIssueDetailSQLServer = require("../server/BidIssueDetailSQLServer.js"); | |
var bidAttachSQLServer = require("../server/AttachSQLServer.js"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MysqlDB.prototype.atomCRUD = function (_sqlOptions) { | |
var self = this; | |
if (!self._pool) { | |
throw new Error("MysqlDB was not initialized"); | |
} | |
return new Promise(function (resolve, reject) { | |
self._pool.getConnection(function(err, connection) { | |
var counter = 0; | |
if (err) { |
OlderNewer