Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
ts-api-demo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wmvm
ts-api-demo
Commits
83448e01
Commit
83448e01
authored
Dec 26, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产管理后台-增加自动对账列表
parent
8d6fa754
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
1 deletion
+115
-1
assetCheck.control.ts
src/functional/mvc/control/v2/assetCheck.control.ts
+19
-0
assetCheck.service.ts
src/functional/mvc/service/v2/assetCheck.service.ts
+95
-1
index.ts
src/functional/router/v2/index.ts
+1
-0
No files found.
src/functional/mvc/control/v2/assetCheck.control.ts
View file @
83448e01
...
...
@@ -160,4 +160,23 @@ export const fundingDailyRecords = async (req: any, commonParam: CommonParam) =>
/**
* 自动对账列表
* @param req
* @param commonParam
*/
export
const
autoCheckList
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"assetCheck.control.fundingDailyRecords"
;
try
{
let
res
=
await
assetCheckService
.
autoCheckList
();
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/service/v2/assetCheck.service.ts
View file @
83448e01
...
...
@@ -8,7 +8,7 @@ import BigNumber from "bignumber.js";
import
{
CommonParam
}
from
"./abkCommonService"
;
let
{
logger
,
apiAssertUtils
:
ApiAssert
,
BigNumberUtils
}
=
require
(
'@madex/ex-js-public'
);
let
{
authCommon
:
AuthCommon
,
redisUtilsCommon
:
RedisClient
,
financeAccountDataUtils
}
=
require
(
'@madex/ex-js-common'
);
let
{
authCommon
:
AuthCommon
,
redisUtilsCommon
:
RedisClient
,
financeAccountDataUtils
,
tickerUtils
}
=
require
(
'@madex/ex-js-common'
);
let
_
=
require
(
'lodash'
);
...
...
@@ -349,6 +349,100 @@ export async function fundingDailyRecords(commonParam: CommonParam) {
}
export
async
function
autoCheckList
()
{
//账号数量
let
account_count
:
any
=
0
;
//总初始资金
let
total_init_asset
:
any
=
new
BigNumber
(
0
);
//总余额
let
total_balance
:
any
=
new
BigNumber
(
0
);
//总变化量
let
total_change_value
:
any
=
new
BigNumber
(
0
);
//分类集合
let
account_data_list
:
any
=
[];
//账户
let
accountList
=
await
financeAccountDataUtils
.
getAccountInfoList
();
if
(
!
accountList
.
length
)
{
return
;
}
let
dataList
=
await
financeAccountDataUtils
.
getMultiCoinFundingDataByAccounts
(
accountList
);
if
(
dataList
.
length
)
{
let
aMap
:
any
=
{};
for
(
let
item
of
accountList
)
{
aMap
[
item
.
id
]
=
item
;
}
//按账户分组
let
groupMap
=
_
.
groupBy
(
dataList
,
'account_id'
);
let
keys
=
_
.
keys
(
groupMap
);
account_count
=
keys
.
length
;
let
tickerMap
:
any
=
{};
for
(
let
account_id
of
keys
)
{
//一个账户的数据
/*[{
init_amount_map:{
"USDT":{
"account_id":1,
"symbol":"USDT",
"amount":50,
"aomunt_usdt":50
}
},
category_id:1,
account_id:1,
multi_coin_map:{
"BTC":1,
"ETH":2,
}
}]*/
let
oneAccountList
=
groupMap
[
account_id
];
for
(
let
oneAccountOneCoinData
of
oneAccountList
)
{
let
initAmountMap
=
oneAccountOneCoinData
.
init_amount_map
;
let
multiCoinMap
=
oneAccountOneCoinData
.
multi_coin_map
;
let
initSymbols
=
_
.
keys
(
initAmountMap
);
let
balanceSymbols
=
_
.
keys
(
multiCoinMap
);
let
symbolsArray
=
_
.
union
(
initSymbols
,
balanceSymbols
);
for
(
let
oneSymbol
of
symbolsArray
)
{
let
symbol_usdt_rate
=
tickerMap
[
oneSymbol
]
?
tickerMap
[
oneSymbol
]
:
await
tickerUtils
.
rateCoin2USDT
(
oneSymbol
);
let
init
=
initAmountMap
[
oneSymbol
]
?
initAmountMap
[
oneSymbol
].
amount
:
0
;
let
init_usdt
=
initAmountMap
[
oneSymbol
]
?
initAmountMap
[
oneSymbol
].
amount_usdt
:
0
;
let
balance
=
multiCoinMap
[
oneSymbol
]
?
multiCoinMap
[
oneSymbol
]
:
0
;
let
balance_usdt
=
new
BigNumber
(
balance
).
mul
(
new
BigNumber
(
symbol_usdt_rate
));
let
listOne
=
{
account_id
:
account_id
,
account_name
:
aMap
[
account_id
]
?
aMap
[
account_id
].
account
:
""
,
remark
:
aMap
[
account_id
]
?
aMap
[
account_id
].
remark
:
""
,
symbol
:
oneSymbol
,
init
:
init
,
init_usdt
:
init_usdt
,
balance
:
balance
,
balance_usdt
:
balance_usdt
,
change
:
new
BigNumber
(
balance
).
sub
(
new
BigNumber
(
init
)),
change_usdt
:
new
BigNumber
(
balance_usdt
).
sub
(
new
BigNumber
(
init_usdt
)),
}
account_data_list
.
push
(
listOne
);
total_init_asset
=
total_init_asset
.
add
(
new
BigNumber
(
init_usdt
));
total_balance
=
total_balance
.
add
(
new
BigNumber
(
balance_usdt
));
total_change_value
=
total_change_value
.
add
(
new
BigNumber
(
listOne
.
change_usdt
));
}
}
}
}
return
{
account_count
,
total_init_asset
,
total_balance
,
total_change_value
,
account_data_list
};
}
async
function
getCoinTypeMapByCoinOrAssetIds
(
coin_ids
:
any
[],
asset_ids
?:
any
[])
{
let
map
:
any
=
{};
let
where
:
any
=
{};
...
...
src/functional/router/v2/index.ts
View file @
83448e01
...
...
@@ -36,6 +36,7 @@ const postFunc = {
'assetCheck/withdrawList'
:
assetCheckCtrl
.
withdrawList
,
//实时提现
'assetCheck/funding/monitor/totalRecords'
:
assetCheckCtrl
.
fundingTotalRecords
,
//资金监控-总记录
'assetCheck/funding/monitor/dailyRecords'
:
assetCheckCtrl
.
fundingDailyRecords
,
//资金监控-每日记录
'assetCheck/auto/checkList'
:
assetCheckCtrl
.
autoCheckList
,
//自动对账列表
//收入分析
'abkFeeStatistics/home/gatherData'
:
feeStatisticsCtrl
.
gatherData
,
//首页数据概览
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment