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
ecfe0997
Commit
ecfe0997
authored
Dec 23, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
金融部-做市资金监控
parent
69a5da57
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
180 additions
and
4 deletions
+180
-4
task.system.trigger.service.ts
cron/service/task.system.trigger.service.ts
+1
-1
assetCheck.control.ts
src/functional/mvc/control/v2/assetCheck.control.ts
+39
-1
abkCommonService.ts
src/functional/mvc/service/v2/abkCommonService.ts
+2
-0
assetCheck.service.ts
src/functional/mvc/service/v2/assetCheck.service.ts
+135
-2
index.ts
src/functional/router/v2/index.ts
+3
-0
No files found.
cron/service/task.system.trigger.service.ts
View file @
ecfe0997
...
@@ -140,7 +140,7 @@ export const doExPairTrigger = async function (trigId: any, pair: string, action
...
@@ -140,7 +140,7 @@ export const doExPairTrigger = async function (trigId: any, pair: string, action
});
});
}
}
else
{
else
{
await
contrac
tPairs
.
prototype
.
update
(
target_value
,
{
await
spo
tPairs
.
prototype
.
update
(
target_value
,
{
where
:
{
where
:
{
id
:
dbPair
.
id
id
:
dbPair
.
id
},
},
...
...
src/functional/mvc/control/v2/assetCheck.control.ts
View file @
ecfe0997
import
*
as
assetCheckService
from
"../../service/v2/assetCheck.service"
;
import
*
as
assetCheckService
from
"../../service/v2/assetCheck.service"
;
import
{
CommonParam
,
setPageAndSize
}
from
"../../service/v2/abkCommonService"
;
import
{
CommonParam
,
setPageAndSize
,
beforeQueryCheckTime
}
from
"../../service/v2/abkCommonService"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
...
@@ -121,5 +121,43 @@ export const withdrawList = async (req: any, commonParam: CommonParam) => {
...
@@ -121,5 +121,43 @@ export const withdrawList = async (req: any, commonParam: CommonParam) => {
};
};
/**
* 资金监控-总记录
* @param req
* @param commonParam
*/
export
const
fundingTotalRecords
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"assetCheck.control.fundingTotalRecords"
;
try
{
let
res
=
await
assetCheckService
.
fundingTotalRecords
();
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 资金监控-每日记录
* @param req
* @param commonParam
*/
export
const
fundingDailyRecords
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"assetCheck.control.fundingDailyRecords"
;
try
{
setPageAndSize
(
commonParam
);
beforeQueryCheckTime
(
commonParam
);
let
res
=
await
assetCheckService
.
fundingDailyRecords
(
commonParam
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/service/v2/abkCommonService.ts
View file @
ecfe0997
...
@@ -20,6 +20,8 @@ export interface CommonParam {
...
@@ -20,6 +20,8 @@ export interface CommonParam {
user_type
?:
any
//查询条件 用户类型:1:普通用户;2:代理用户(crm用户)
user_type
?:
any
//查询条件 用户类型:1:普通用户;2:代理用户(crm用户)
asset_id
?:
any
asset_id
?:
any
category_id
?:
any
//分类id
}
}
export
function
setPageAndSize
(
commonParam
:
CommonParam
)
{
export
function
setPageAndSize
(
commonParam
:
CommonParam
)
{
...
...
src/functional/mvc/service/v2/assetCheck.service.ts
View file @
ecfe0997
import
{
madAdminOrmDB
,
coinAddress
,
coinType
,
mainUserAsset
,
dwdSpotAssetsApi
,
ormDB
,
coinTx
,
coinWithdraw
,
walletAssets
}
from
"@madex/ex-ts-dao"
;
import
{
madAdminOrmDB
,
coinAddress
,
coinType
,
mainUserAsset
,
dwdSpotAssetsApi
,
ormDB
,
coinTx
,
coinWithdraw
,
walletAssets
,
financeAccountCategory
,
financeAccount
,
financeAccountDailyRecord
}
from
"@madex/ex-ts-dao"
;
import
BigNumber
from
"bignumber.js"
;
import
BigNumber
from
"bignumber.js"
;
import
{
CommonParam
}
from
"./abkCommonService"
;
let
{
logger
,
apiAssertUtils
:
ApiAssert
,
BigNumberUtils
}
=
require
(
'@madex/ex-js-public'
);
let
{
logger
,
apiAssertUtils
:
ApiAssert
,
BigNumberUtils
}
=
require
(
'@madex/ex-js-public'
);
let
{
authCommon
:
AuthCommon
,
redisUtilsCommon
:
RedisClient
,
}
=
require
(
'@madex/ex-js-common'
);
let
{
authCommon
:
AuthCommon
,
redisUtilsCommon
:
RedisClient
,
financeAccountDataUtils
}
=
require
(
'@madex/ex-js-common'
);
let
_
=
require
(
'lodash'
);
let
_
=
require
(
'lodash'
);
...
@@ -215,6 +221,133 @@ export async function withdrawList(page: any, size: any, uid_or_addr: any) {
...
@@ -215,6 +221,133 @@ export async function withdrawList(page: any, size: any, uid_or_addr: any) {
return
pageData
return
pageData
}
}
export
async
function
fundingTotalRecords
()
{
//分类数量
let
category_count
:
any
=
0
;
//总初始资金
let
total_init_asset
:
any
=
new
BigNumber
(
0
);
//总余额
let
total_balance
:
any
=
new
BigNumber
(
0
);
//总差值
let
total_sub_value
:
any
=
new
BigNumber
(
0
);
//分类集合
let
category_list
:
any
=
[];
//账户
let
accountList
=
await
financeAccountDataUtils
.
getAccountInfoList
();
if
(
!
accountList
.
length
)
{
return
;
}
let
dataList
=
await
financeAccountDataUtils
.
getFundingDataByAccounts
(
accountList
);
if
(
dataList
.
length
)
{
let
cMap
:
any
=
{};
//查询所有分类
let
cList
=
await
financeAccountCategory
.
prototype
.
findAll
({
attributes
:
[
'id'
,
'name'
],
where
:
{},
raw
:
true
});
for
(
let
item
of
cList
)
{
cMap
[
item
.
id
]
=
item
.
name
;
}
//按类别分组
let
groupMap
=
_
.
groupBy
(
dataList
,
'category_id'
);
let
keys
=
_
.
keys
(
groupMap
);
category_count
=
keys
.
length
;
for
(
let
category_id
of
keys
)
{
//一个分类下所有账户的数据
let
oneCategoryList
=
groupMap
[
category_id
];
let
oneInitAsset
=
_
.
sumBy
(
oneCategoryList
,
(
item
)
=>
new
BigNumber
(
item
.
init_amount_usdt
).
toNumber
());
let
oneBalance
=
_
.
sumBy
(
oneCategoryList
,
(
item
)
=>
new
BigNumber
(
item
.
balance_usdt
).
toNumber
());
let
oneSubValue
=
new
BigNumber
(
oneBalance
).
sub
(
new
BigNumber
(
oneInitAsset
));
let
item
:
any
=
{
category_id
:
category_id
,
category_name
:
cMap
[
category_id
]
?
cMap
[
category_id
]
:
""
,
init_asset
:
oneInitAsset
,
balance
:
oneBalance
,
sub_value
:
oneSubValue
,
}
total_init_asset
=
total_init_asset
.
add
(
oneInitAsset
);
total_balance
=
total_balance
.
add
(
oneBalance
);
total_sub_value
=
total_sub_value
.
add
(
oneSubValue
);
category_list
.
push
(
item
);
}
}
return
{
category_count
,
total_init_asset
,
total_balance
,
total_sub_value
,
category_list
};
}
export
async
function
fundingDailyRecords
(
commonParam
:
CommonParam
)
{
let
res
:
any
;
let
accountMap
:
any
=
{};
let
where
:
any
=
{};
if
(
commonParam
.
category_id
)
{
where
[
"category_id"
]
=
Number
(
commonParam
.
category_id
);
}
where
[
ormDB
.
Op
.
and
]
=
[
{
createdAt
:
{
[
ormDB
.
Op
.
gte
]:
commonParam
.
from_time
}
},
{
createdAt
:
{
[
ormDB
.
Op
.
lt
]:
commonParam
.
to_time
},
}];
if
(
!
commonParam
.
category_id
)
{
//总体账户
res
=
await
financeAccountDailyRecord
.
prototype
.
findAndCount
({
attributes
:
[
'record_date'
,
ormDB
.
literal
(
'sum(init_amount_usdt) as init_amount_usdt'
),
ormDB
.
literal
(
'sum(balance_usdt) as balance_usdt'
)],
where
:
where
,
limit
:
commonParam
.
size
,
offset
:
(
Number
(
commonParam
.
page
)
-
1
)
*
Number
(
commonParam
.
size
),
group
:
[
'record_date'
],
order
:
[[
"record_date"
,
"desc"
]],
raw
:
true
});
}
else
{
//某个分类下的账户
res
=
await
financeAccountDailyRecord
.
prototype
.
findAndCount
({
attributes
:
[
'record_date'
,
'account_id'
,
ormDB
.
literal
(
'sum(init_amount_usdt) as init_amount_usdt'
),
ormDB
.
literal
(
'sum(balance_usdt) as balance_usdt'
)],
where
:
where
,
limit
:
commonParam
.
size
,
offset
:
(
Number
(
commonParam
.
page
)
-
1
)
*
Number
(
commonParam
.
size
),
group
:
[
'record_date'
,
'account_id'
],
order
:
[[
"record_date"
,
"desc"
]],
raw
:
true
});
let
accountIds
=
res
.
rows
.
map
(
item
=>
item
.
account_id
);
if
(
accountIds
.
length
)
{
let
dbAccounts
=
await
financeAccount
.
prototype
.
findAll
({
attributes
:
[
'id'
,
'account'
],
where
:
{
id
:
accountIds
},
raw
:
true
});
for
(
let
item
of
dbAccounts
)
{
accountMap
[
item
.
id
]
=
item
.
account
;
}
}
}
res
.
count
=
res
.
count
.
length
;
for
(
let
item
of
res
.
rows
)
{
item
.
account_name
=
item
.
account_id
&&
accountMap
[
item
.
account_id
]
?
accountMap
[
item
.
account_id
]
:
""
;
item
.
sub_value
=
new
BigNumber
(
item
.
balance_usdt
).
sub
(
new
BigNumber
(
item
.
init_amount_usdt
));
}
return
res
;
}
async
function
getCoinTypeMapByCoinOrAssetIds
(
coin_ids
:
any
[],
asset_ids
?:
any
[])
{
async
function
getCoinTypeMapByCoinOrAssetIds
(
coin_ids
:
any
[],
asset_ids
?:
any
[])
{
let
map
:
any
=
{};
let
map
:
any
=
{};
...
...
src/functional/router/v2/index.ts
View file @
ecfe0997
...
@@ -34,6 +34,9 @@ const postFunc = {
...
@@ -34,6 +34,9 @@ const postFunc = {
'assetCheck/siteAssetsDetails'
:
assetCheckCtrl
.
siteAssetsDetails
,
//站内资产-详情
'assetCheck/siteAssetsDetails'
:
assetCheckCtrl
.
siteAssetsDetails
,
//站内资产-详情
'assetCheck/depositList'
:
assetCheckCtrl
.
depositList
,
//实时充值
'assetCheck/depositList'
:
assetCheckCtrl
.
depositList
,
//实时充值
'assetCheck/withdrawList'
:
assetCheckCtrl
.
withdrawList
,
//实时提现
'assetCheck/withdrawList'
:
assetCheckCtrl
.
withdrawList
,
//实时提现
'assetCheck/funding/monitor/totalRecords'
:
assetCheckCtrl
.
fundingTotalRecords
,
//资金监控-总记录
'assetCheck/funding/monitor/dailyRecords'
:
assetCheckCtrl
.
fundingDailyRecords
,
//资金监控-每日记录
//收入分析
//收入分析
'abkFeeStatistics/home/gatherData'
:
feeStatisticsCtrl
.
gatherData
,
//首页数据概览
'abkFeeStatistics/home/gatherData'
:
feeStatisticsCtrl
.
gatherData
,
//首页数据概览
'abkFeeStatistics/getFeeData'
:
feeStatisticsCtrl
.
getFeeData
,
//平台、现货、合约 手续费查询
'abkFeeStatistics/getFeeData'
:
feeStatisticsCtrl
.
getFeeData
,
//平台、现货、合约 手续费查询
...
...
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