Commit 72108c1a authored by ml's avatar ml

增加返回值

parent 1562dc97
import { coinTx, coinWithdraw, ormDB } from "@madex/ex-ts-dao"; import { coinTx, coinWithdraw, ormDB } from "@madex/ex-ts-dao";
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { addOptLog } from "./userOptLog.service"; import { addOptLog } from "./userOptLog.service";
import BigNumber from "bignumber.js";
let { tickerUtils } = require('@madex/ex-js-common');
let _ = require('lodash'); let _ = require('lodash');
...@@ -56,6 +59,7 @@ export async function depositList(pageVO: QueryVO) { ...@@ -56,6 +59,7 @@ export async function depositList(pageVO: QueryVO) {
order: [["createdAt", "desc"]], order: [["createdAt", "desc"]],
raw: true raw: true
}); });
await dealReturnData(resList);
return resList; return resList;
} }
...@@ -94,7 +98,21 @@ export async function withdrawList(pageVO: QueryVO) { ...@@ -94,7 +98,21 @@ export async function withdrawList(pageVO: QueryVO) {
order: [["createdAt", "desc"]], order: [["createdAt", "desc"]],
raw: true raw: true
}); });
await dealReturnData(resList);
return resList; return resList;
} }
async function dealReturnData(resList: any) {
if (resList.rows.length) {
let usdtTickerMap = {};
for (let item of resList.rows) {
let symbol = item.coin_symbol;
let amount = item.amount;
let usdt = usdtTickerMap[symbol] ? usdtTickerMap[symbol] : await tickerUtils._rateCoin2USDT(symbol);
usdtTickerMap[symbol] = usdt;
item.equal_usdt = new BigNumber(usdt).mul(amount);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment