From 019865bc95061e2b51be527b2f0f974ed97aa7b2 Mon Sep 17 00:00:00 2001 From: k7 Date: Tue, 22 Apr 2014 00:19:15 +0800 Subject: [PATCH] fix auto create worker bug --- libs/mposCompatibility.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/mposCompatibility.js b/libs/mposCompatibility.js index a82875d..d94c8cd 100644 --- a/libs/mposCompatibility.js +++ b/libs/mposCompatibility.js @@ -52,7 +52,7 @@ module.exports = function(logger, poolConfig){ if(mposConfig.autoCreateWorker){ var account = workerName.split('.')[0]; connection.query( - 'SELECT username FROM accounts WHERE username = LOWER(?)', + 'SELECT id,username FROM accounts WHERE username = LOWER(?)', [account.toLowerCase()], function(err, result){ if (err){ @@ -63,7 +63,7 @@ module.exports = function(logger, poolConfig){ authCallback(false); }else{ connection.query( - "INSERT INTO `pool_worker` (`id`, `account_id`, `username`, `password`, `difficulty`, `monitor`) VALUES (NULL, ?, ?, ?, '0', '0');", + "INSERT INTO `pool_worker` (`account_id`, `username`, `password`) VALUES (?, ?, ?);", [result[0].id,workerName.toLowerCase(),password], function(err, result){ if (err){