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 btc = deriveNewAccount(ROOTSECWORD, { coin: 'BTC', seed });
const eth = deriveNewAccount(ROOTSECWORD, { coin: 'ETH', seed });
const user = await User.findByIdAndUpdate(userId, {
const fund = await Fund.findOneAndUpdate({userId}, {
$set: {
tokenAddress: {
usdtBTC: btc,
@@ -152,14 +152,14 @@ module.exports = {
mylog.error(err);
return null;
});
data = user && user.tokenAddress;
data = fund && fund.tokenAddress;
}
return data ? res.json({
code: 0,
data
}) : res.json({
code: 1,
error: res
code: 500,
msg: '系统错误'
});
};
}),