我正在尝试查找此代码的错误,但我无法找到它 声明或声明预期错误
function deleteFromGame() {
for (var k in removefromGame) {
if (removefromGame[k]['expire'] - time() <= 0) {
pool.query('SELECT trade_token FROM games WHERE id= ' + pool.escape(removefromGame[k]['id']), function(err, row) {
if (err)
throw err;
if (row.length == 0)
return;
if (row[0].trade_token == '') {
var offer = removefromGame[k]['offer'];
offer.decline((err)=>{
if (err)
return;
pool.query('UPDATE games SET psteamid = "", pname = "", pavatar = "", pskinsurl = "", pskinsnames = "", pskinsprices = "", ptp = "", passetids = "", trade_token = "" WHERE id = ' + pool.escape(removefromGame[k]['id']), function(er, ro) {});
loadAllGames();
sendGames(removefromGame[k]['id']);
}
);
}
});
}
}
}
你能帮我解决这个问题吗,对我来说是个头疼的问题
答案 0 :(得分:1)
您应该为代码使用任何代码样式,并使用tab
或space
。
我编辑了您的代码:
function deleteFromGame() {
for (var k in removefromGame) {
if (removefromGame[k]['expire'] - time() <= 0) {
pool.query('SELECT trade_token FROM games WHERE id= ' + pool.escape(removefromGame[k]['id']), function(err, row) {
if (err)
throw err;
if (row.length == 0)
return;
if (row[0].trade_token == '') {
var offer = removefromGame[k]['offer'];
offer.decline((err)=>{
if (err)
return;
pool.query('UPDATE games SET psteamid = "", pname = "", pavatar = "", pskinsurl = "", pskinsnames = "", pskinsprices = "", ptp = "", passetids = "", trade_token = "" WHERE id = ' + pool.escape(removefromGame[k]['id']), function(er, ro) {});
loadAllGames();
sendGames(removefromGame[k]['id']);
});
}
});
}
}
}