运行 node.js 时,使用此合成器获得 current_game 的“未定义存款”结果:
if(offer.items_to_receive == undefined) return;
mysqlConnection.query('SELECT `value` FROM `info` WHERE `name`=\'maxitems\'',
function(err, row, fields) {
if(offer.items_to_receive.length > row[0].value) {
offers.declineOffer({tradeOfferId: offer.tradeofferid});
offer.items_to_receive = [];
var unixtime = Math.round(new Date().getTime()/1000.0);
mysqlConnection.query('INSERT INTO `messages` (`userid`,`msg`,`from`, `win`, `system`, `time`) VALUES (\''+offer.steamid_other+'\',\'Sorry, but you deposited too many items\',\'System\', \'0\', \'1\', \''+unixtime+'\')', function(err, row, fields) {});
return;
} else {
mysqlConnection.query('SELECT `value` FROM `info` WHERE `name`=\'current_game\'',
function(err, row, fields) {
var current_game = (row[0].value);
mysqlConnection.query('SELECT COUNT(item) FROM `game' + current_game + '` AS maxitemperperson WHERE `userid`=\''+offer.steamid_other+'\'' , function(err, row) {
someVari = row[0].maxitemperperson;
console.log('Deposited over ' +someVari);
if((someVari + offer.items_to_receive.length) > 10) {
offers.declineOffer({tradeOfferId: offer.tradeofferid});
mysqlConnection.query('INSERT INTO `messages` (`userid`,`msg`,`from`, `win`, `system`, `time`) VALUES (\''+offer.steamid_other+'\',\'Sorry, but you deposited too many items\',\'System\', \'0\', \'1\', \''+unixtime+'\')', function(err, rowl, fields) {});
return;
}
})
})
}
});
合成器的错误在哪里?基本上,直到“else”的第一部分正在工作,但之后我试图计算具有相同用户 ID 的某个表(通过 current_game 变量动态生成)中的项目数,然后添加另一个项目数和与 10 进行比较(也可以写为 row[0].value。
任何帮助,将不胜感激。