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
e2eee981
Commit
e2eee981
authored
Jan 23, 2025
by
1486327116
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
d58f43a4
763a14f4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
170 additions
and
4 deletions
+170
-4
abkFeeStatistics.control.ts
src/functional/mvc/control/v2/abkFeeStatistics.control.ts
+24
-0
assetCheck.control.ts
src/functional/mvc/control/v2/assetCheck.control.ts
+22
-0
abkFeeStatistics.service.ts
src/functional/mvc/service/v2/abkFeeStatistics.service.ts
+37
-2
assetCheck.service.ts
src/functional/mvc/service/v2/assetCheck.service.ts
+85
-2
index.ts
src/functional/router/v2/index.ts
+2
-0
No files found.
src/functional/mvc/control/v2/abkFeeStatistics.control.ts
View file @
e2eee981
...
...
@@ -44,6 +44,27 @@ export const getFeeData = async (req: any, commonParam: CommonParam) => {
}
};
/**
* 昨日数据页签-查询手续费数据
* query_type 1 现货 2 U本位合约 3 币本位合约 4 全部(包含提现)
* @param req
* @param commonParam
*/
export
const
getYesTabFeeData
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"abkFeeStatistics.control.getYesTabFeeData"
;
try
{
setPageAndSize
(
commonParam
);
beforeQueryCheckTime
(
commonParam
);
let
type
=
Number
(
commonParam
.
query_type
)
||
4
;
let
res
=
await
abkFeeStatisticsService
.
getYesTabFeeData
(
commonParam
.
from_time
,
commonParam
.
to_time
,
commonParam
.
page
,
commonParam
.
size
,
type
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 查询手续费数据详情(分用户)
...
...
@@ -101,6 +122,9 @@ export const withdrawDataDetails = async (req: any, commonParam: CommonParam) =>
let
func_name
=
"abkFeeStatistics.control.withdrawDataDetails"
;
try
{
setPageAndSize
(
commonParam
);
if
(
!
commonParam
.
from_time
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
let
user_id
=
Number
(
commonParam
.
user_id
||
0
);
let
res
=
await
abkFeeStatisticsService
.
withdrawDataDetails
(
commonParam
.
from_time
,
commonParam
.
to_time
,
commonParam
.
page
,
commonParam
.
size
,
user_id
);
return
Res3Utils
.
result
(
res
);
...
...
src/functional/mvc/control/v2/assetCheck.control.ts
View file @
e2eee981
...
...
@@ -179,4 +179,26 @@ export const autoCheckList = async (req: any, commonParam: CommonParam) => {
/**
* 钱包流入流出列表
* @param req
* @param commonParam
*/
export
const
walletInOutList
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"assetCheck.control.walletInOutList"
;
try
{
setPageAndSize
(
commonParam
);
beforeQueryCheckTime
(
commonParam
);
let
res
=
await
assetCheckService
.
walletInOutList
(
commonParam
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/service/v2/abkFeeStatistics.service.ts
View file @
e2eee981
...
...
@@ -122,6 +122,34 @@ export async function getFeeData(from_time: any, to_time: any, page: any, size:
return
pageData
;
}
/**
* 昨日数据页签-手续费数据
* @param from_time
* @param to_time
* @param page
* @param size
* @param type 1 现货 2 U本位合约 3 币本位合约 4 全部(包含提现)
*/
export
async
function
getYesTabFeeData
(
from_time
:
any
,
to_time
:
any
,
page
:
any
,
size
:
any
,
type
:
number
)
{
//查询总体数据
let
total_obj
=
await
getTotalFeeDataOfPeriodByType
(
from_time
,
to_time
,
type
);
//查询全部时要查询提现手续费
if
(
type
==
4
)
{
let
{
withdrawDtFeeMap
,
withdraw_total_fee
,
withdraw_common_user_fee
,
withdraw_crm_user_fee
}
=
await
getTotalWithdrawFeeByDtGroup
(
from_time
,
to_time
);
//加上提现手续费
total_obj
.
total_fee
=
total_obj
.
total_fee
.
add
(
withdraw_total_fee
);
total_obj
.
common_user
.
fee
=
total_obj
.
common_user
.
fee
.
add
(
withdraw_common_user_fee
);
total_obj
.
crm_user
.
fee
=
total_obj
.
crm_user
.
fee
.
add
(
withdraw_crm_user_fee
);
}
//查询详细数据
let
pageData
=
await
getFeeDataDetails
(
from_time
,
to_time
,
page
,
size
,
type
,
3
,
0
);
pageData
[
"total_data"
]
=
total_obj
;
return
pageData
;
}
/**
* 手续费数据详情
* @param from_time
...
...
@@ -129,7 +157,7 @@ export async function getFeeData(from_time: any, to_time: any, page: any, size:
* @param page
* @param size
* @param type 1 现货 2 U本位合约 3 币本位合约 4 全部(不含提现,提现单独接口)
* @param user_type 用户类型:1:普通用户;2:代理用户(crm用户)
* @param user_type 用户类型:1:普通用户;2:代理用户(crm用户)
;3:全部用户;
* @param user_id
*/
export
async
function
getFeeDataDetails
(
from_time
:
any
,
to_time
:
any
,
page
:
any
,
size
:
any
,
type
:
number
,
user_type
:
number
,
user_id
:
number
)
{
...
...
@@ -170,8 +198,15 @@ export async function getFeeDataDetails(from_time: any, to_time: any, page: any,
cond_common_user_ids
.
push
(
item
);
}
}
let
cond_user_ids
:
any
=
[];
//全部用户
if
(
user_type
==
3
)
{
cond_user_ids
=
_
.
union
(
cond_common_user_ids
,
cond_crm_user_ids
);
}
else
{
cond_user_ids
=
user_type
==
1
?
cond_common_user_ids
:
cond_crm_user_ids
;
}
let
cond_user_ids
=
user_type
==
1
?
cond_common_user_ids
:
cond_crm_user_ids
;
if
(
!
cond_user_ids
.
length
)
{
return
{
...
...
src/functional/mvc/service/v2/assetCheck.service.ts
View file @
e2eee981
...
...
@@ -2,12 +2,12 @@ import {
madAdminOrmDB
,
coinAddress
,
coinType
,
mainUserAsset
,
dwdSpotAssetsApi
,
ormDB
,
coinTx
,
coinWithdraw
,
walletAssets
,
financeAccountCategory
,
financeAccount
,
financeAccountDailyRecord
financeAccountDailyRecord
,
abkWalletDailySnap
}
from
"@madex/ex-ts-dao"
;
import
BigNumber
from
"bignumber.js"
;
import
{
CommonParam
}
from
"./abkCommonService"
;
let
{
logger
,
apiAssertUtils
:
ApiAssert
,
BigNumberUtils
}
=
require
(
'@madex/ex-js-public'
);
let
{
logger
,
apiAssertUtils
:
ApiAssert
,
BigNumberUtils
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
let
{
authCommon
:
AuthCommon
,
redisUtilsCommon
:
RedisClient
,
financeAccountDataUtils
,
tickerUtils
}
=
require
(
'@madex/ex-js-common'
);
let
_
=
require
(
'lodash'
);
...
...
@@ -615,4 +615,87 @@ async function getSiteWalletAssetsGroupBy(conditions: any[], group_by_field: str
}
export
async
function
walletInOutList
(
commonParam
:
CommonParam
)
{
let
from_time
=
commonParam
.
from_time
;
let
to_time
=
commonParam
.
to_time
;
let
page
=
Number
(
commonParam
.
page
);
let
size
=
Number
(
commonParam
.
size
);
//查询昨日流入流出 和 总计流入流出
let
opAnd
=
{
createdAt
:
{
[
ormDB
.
Op
.
gte
]:
from_time
,
[
ormDB
.
Op
.
lt
]:
to_time
}
};
let
walletTask
=
abkWalletDailySnap
.
prototype
.
findAll
({
attributes
:
[
'snap_date'
,
ormDB
.
literal
(
'sum(case when change_amount >= 0 then ABS(`change_eq_usdt`) else 0 end) as in_amount'
),
ormDB
.
literal
(
'sum(case when change_amount < 0 then ABS(`change_eq_usdt`) else 0 end) as out_amount'
)],
where
:
{
[
ormDB
.
Op
.
and
]:
opAnd
,
},
group
:
[
'snap_date'
],
order
:
[[
'snap_date'
,
'desc'
]],
raw
:
true
});
//按正常来说 snap_date 倒序 第一个就是昨天的数据
//比较一下日期 如果没有 就先置为 0
let
pageTask
=
abkWalletDailySnap
.
prototype
.
findAndCount
({
where
:
{
[
ormDB
.
Op
.
and
]:
opAnd
,
},
limit
:
size
,
offset
:
(
page
-
1
)
*
size
,
order
:
[[
"snap_date"
,
"desc"
]],
raw
:
true
})
let
[
walletDataList
,
pageData
]
=
await
Promise
.
all
([
walletTask
,
pageTask
]);
let
yesterday_in
=
new
BigNumber
(
0
);
let
yesterday_out
=
new
BigNumber
(
0
);
let
total_in
=
new
BigNumber
(
0
);
let
total_out
=
new
BigNumber
(
0
);
let
today
=
datetimeUtils
.
trim
(
new
Date
(),
'd'
);
let
yesterday
=
datetimeUtils
.
sub
(
today
,
datetimeUtils
.
DAY
);
for
(
let
item
of
walletDataList
)
{
let
inAmount
=
item
.
in_amount
;
let
outAmount
=
item
.
out_amount
;
total_in
=
total_in
.
add
(
new
BigNumber
(
inAmount
));
total_out
=
total_out
.
add
(
new
BigNumber
(
outAmount
));
}
if
(
walletDataList
.
length
&&
walletDataList
[
0
])
{
let
snapDate
=
walletDataList
[
0
].
snap_date
;
let
inAmount
=
walletDataList
[
0
].
in_amount
;
let
outAmount
=
walletDataList
[
0
].
out_amount
;
let
yts
=
new
Date
(
yesterday
).
getTime
();
let
sts
=
new
Date
(
snapDate
).
getTime
();
//库里的最新纪录是昨天的 ,任务定时在跑, 如果不是昨天的 定时任务可能出问题了
if
(
yts
==
sts
)
{
yesterday_in
=
new
BigNumber
(
inAmount
);
yesterday_out
=
new
BigNumber
(
outAmount
);
}
}
let
gather_data
=
{
yesterday_in
,
yesterday_out
,
yesterday_in_out
:
yesterday_in
.
sub
(
yesterday_out
),
total_in
,
total_out
,
total_in_out
:
total_in
.
sub
(
total_out
),
}
pageData
[
'gather_data'
]
=
gather_data
;
return
pageData
;
}
src/functional/router/v2/index.ts
View file @
e2eee981
...
...
@@ -37,10 +37,12 @@ const postFunc = {
'assetCheck/funding/monitor/totalRecords'
:
assetCheckCtrl
.
fundingTotalRecords
,
//资金监控-总记录
'assetCheck/funding/monitor/dailyRecords'
:
assetCheckCtrl
.
fundingDailyRecords
,
//资金监控-每日记录
'assetCheck/auto/checkList'
:
assetCheckCtrl
.
autoCheckList
,
//自动对账列表
'assetCheck/walletInOutList'
:
assetCheckCtrl
.
walletInOutList
,
//钱包流入流出
//收入分析
'abkFeeStatistics/home/gatherData'
:
feeStatisticsCtrl
.
gatherData
,
//首页数据概览
'abkFeeStatistics/getFeeData'
:
feeStatisticsCtrl
.
getFeeData
,
//平台、现货、合约 手续费查询
'abkFeeStatistics/getYesTabFeeData'
:
feeStatisticsCtrl
.
getYesTabFeeData
,
//昨日数据页签-平台、现货、合约 手续费查询
'abkFeeStatistics/getFeeDataDetails'
:
feeStatisticsCtrl
.
getFeeDataDetails
,
//平台、现货、合约 手续费查询详情
'abkFeeStatistics/withdrawData'
:
feeStatisticsCtrl
.
withdrawData
,
//提现手续费
'abkFeeStatistics/withdrawDataDetails'
:
feeStatisticsCtrl
.
withdrawDataDetails
,
//提现手续费详情
...
...
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