feat: 社区模块

This commit is contained in:
chaosBreaking
2019-09-08 00:16:13 +08:00
parent 898ed9c6c1
commit e861252812
5 changed files with 56 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ const { deriveNewAccount } = require('../../utils/account');
const actionFilter = 'id type amount detail op createdAt';
const { inject } = require('../../common/Provider');
const ETH = require('../../utils/erc20').ERC20;
const { USDTAddr } = require('../../common/constant');
const depositCoinsList = [{
id: 'usdtBTC',
@@ -189,7 +190,14 @@ module.exports = {
// 查询资金,直接拉数据库,区块链的查询交给定时任务
async refreshFund (req, res) {
// todo: 要求刷新程序去刷新
const { userId } = res.locals.user;
const fund = await Fund.findOne({ userId }).exec();
const tokenAddress = fund && fund.tokenAddress;
if(!tokenAddress || !tokenAddress['usdtETH']) return res.json({
code: 0,
data: fund.fundList
});
const txActions = await ETH.getActions(tokenAddress['usdtETH'], USDTAddr);
return this.getFundList(req, res);
},
async getFundList (req, res) {