我在NodeJS的快速服务器中有以下代码行:
sql = "SELECT mName FROM tokenMerchant " +
"WHERE mUUID = ?";
console.log("Merchant ID: ",tr.merchantId);
pool.getConnection(function(err, conn){
if (err) throw err;
function getMerchantName(query){
return new Promise(function (resolve, reject){
pool.query(query, [tr.merchantId], function(err, result){
if(err) return reject(err);
resolve(result);
});
});
};
getMerchantName(sql).then(
result => {
tr.secondaryName = result[0].mName;
console.log("Secondary Name: ",tr.secondaryName);
conn.release;
getUrl();
}
).catch(
error => {
console.log('Rejected');
}
);
});
function getRUrl(){//some codes here after promise resolved
}
我的问题是:
getUrl()
resolved
和rejected
?请告诉我上述代码有什么问题。谢谢。