fix: bugs of queryAddress

This commit is contained in:
chaosBreaking
2019-09-07 16:32:14 +08:00
parent 403da58e78
commit 1326023832

View File

@@ -141,7 +141,7 @@ module.exports = {
const seed = parseInt(userId.substring(0, 8), 16).toString().slice(4); //前4位与Date.now前4位重复; const seed = parseInt(userId.substring(0, 8), 16).toString().slice(4); //前4位与Date.now前4位重复;
const btc = deriveNewAccount(ROOTSECWORD, { coin: 'BTC', seed }); const btc = deriveNewAccount(ROOTSECWORD, { coin: 'BTC', seed });
const eth = deriveNewAccount(ROOTSECWORD, { coin: 'ETH', seed }); const eth = deriveNewAccount(ROOTSECWORD, { coin: 'ETH', seed });
const user = await User.findByIdAndUpdate(userId, { const fund = await Fund.findOneAndUpdate({userId}, {
$set: { $set: {
tokenAddress: { tokenAddress: {
usdtBTC: btc, usdtBTC: btc,
@@ -152,14 +152,14 @@ module.exports = {
mylog.error(err); mylog.error(err);
return null; return null;
}); });
data = user && user.tokenAddress; data = fund && fund.tokenAddress;
} }
return data ? res.json({ return data ? res.json({
code: 0, code: 0,
data data
}) : res.json({ }) : res.json({
code: 1, code: 500,
error: res msg: '系统错误'
}); });
}; };
}), }),