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
8d1a7179
Commit
8d1a7179
authored
Nov 08, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
交易用户数据
parent
4b0a134f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
10 deletions
+82
-10
spotData.service.ts
src/functional/mvc/service/spotData.service.ts
+81
-9
index.ts
src/functional/router/v1/index.ts
+1
-1
No files found.
src/functional/mvc/service/spotData.service.ts
View file @
8d1a7179
...
@@ -3,7 +3,10 @@ import {
...
@@ -3,7 +3,10 @@ import {
userLog
,
userLog
,
userInfo
,
userInfo
,
userRealName
,
userRealName
,
mainUserBills
mainUserBills
,
dwsUserDailyTrade
,
dwsUserDailyFee
,
dwsMadOrmDB
}
from
"@madex/ex-ts-dao"
;
}
from
"@madex/ex-ts-dao"
;
import
BigNumber
from
"bignumber.js"
;
import
BigNumber
from
"bignumber.js"
;
...
@@ -61,13 +64,51 @@ export async function increaseUserList(pageVO: QueryVO) {
...
@@ -61,13 +64,51 @@ export async function increaseUserList(pageVO: QueryVO) {
export
async
function
tradeUserList
(
pageVO
:
QueryVO
)
{
export
async
function
tradeUserList
(
pageVO
:
QueryVO
)
{
//TODO:
let
res
=
{
count
:
0
,
rows
:
[]
}
return
res
let
where
:
any
=
{
type
:
0
,
//UTC 0
category
:
1
,
//现货
[
dwsMadOrmDB
.
Op
.
and
]:
[
{
trade_date
:
{
[
dwsMadOrmDB
.
Op
.
gte
]:
pageVO
.
from_time
}
},
{
trade_date
:
{
[
dwsMadOrmDB
.
Op
.
lt
]:
pageVO
.
to_time
},
}]
};
let
resList
:
any
=
[];
if
(
!
pageVO
.
is_export
)
{
resList
=
await
dwsUserDailyTrade
.
prototype
.
findAndCount
({
attributes
:[
'user_id'
,
dwsMadOrmDB
.
literal
(
'sum(equal_usdt + equal_usdt_free) as trade_amount'
)],
where
:
where
,
limit
:
pageVO
.
size
,
offset
:
(
Number
(
pageVO
.
page
)
-
1
)
*
Number
(
pageVO
.
size
),
order
:
[[
dwsMadOrmDB
.
literal
(
'trade_amount'
),
"desc"
]],
group
:
[
'user_id'
],
raw
:
true
});
resList
.
count
=
resList
.
count
.
length
;
let
uids
=
resList
.
rows
.
map
(
item
=>
item
.
user_id
);
if
(
uids
){
where
[
"user_id"
]
=
uids
await
dealFeeData
(
where
,
resList
.
rows
);
}
}
else
{
//导出不分页
resList
=
await
dwsUserDailyTrade
.
prototype
.
findAll
({
attributes
:[
'user_id'
,
dwsMadOrmDB
.
literal
(
'sum(equal_usdt + equal_usdt_free) as trade_amount'
)],
where
:
where
,
order
:
[[
"trade_amount"
,
"desc"
]],
group
:
[
'user_id'
],
raw
:
true
});
let
uids
=
resList
.
map
(
item
=>
item
.
user_id
);
if
(
uids
){
where
[
"user_id"
]
=
uids
await
dealFeeData
(
where
,
resList
);
}
}
return
resList
;
}
}
export
async
function
activeUserList
(
pageVO
:
QueryVO
)
{
export
async
function
activeUserList
(
pageVO
:
QueryVO
)
{
...
@@ -278,8 +319,24 @@ async function increaseUserCount(pageVO: QueryVO) {
...
@@ -278,8 +319,24 @@ async function increaseUserCount(pageVO: QueryVO) {
}
}
async
function
tradeUserCount
(
pageVO
:
QueryVO
)
{
async
function
tradeUserCount
(
pageVO
:
QueryVO
)
{
//TODO:查询交易数据
return
0
;
let
where
:
any
=
{
type
:
0
,
//UTC 0
category
:
1
,
//现货
[
dwsMadOrmDB
.
Op
.
and
]:
[
{
trade_date
:
{
[
dwsMadOrmDB
.
Op
.
gte
]:
pageVO
.
from_time
}
},
{
trade_date
:
{
[
dwsMadOrmDB
.
Op
.
lt
]:
pageVO
.
to_time
},
}]
};
let
dbList
=
await
dwsUserDailyTrade
.
prototype
.
findAll
({
attributes
:[
dwsMadOrmDB
.
literal
(
'distinct(user_id) as user_id'
)],
where
:
where
,
raw
:
true
});
return
dbList
.
length
;
}
}
...
@@ -417,6 +474,21 @@ async function dealDepositAndWithdrawReturnData(resList: any) {
...
@@ -417,6 +474,21 @@ async function dealDepositAndWithdrawReturnData(resList: any) {
}
}
}
}
async
function
dealFeeData
(
where
:
any
,
dbList
:
any
){
let
dbFeeList
=
await
dwsUserDailyFee
.
prototype
.
findAll
({
attributes
:[
'user_id'
,
dwsMadOrmDB
.
literal
(
'sum(equalusdt_amount) as fee_amount'
)],
where
:
where
,
group
:[
'user_id'
],
raw
:
true
});
let
fee_map
:
any
=
{};
for
(
let
item
of
dbFeeList
)
{
fee_map
[
item
.
user_id
]
=
item
.
fee_amount
;
}
for
(
let
item
of
dbList
)
{
item
.
fee_amount
=
fee_map
[
item
.
user_id
]
?
fee_map
[
item
.
user_id
]
:
0
}
}
...
...
src/functional/router/v1/index.ts
View file @
8d1a7179
...
@@ -266,7 +266,7 @@ const postFunc = {
...
@@ -266,7 +266,7 @@ const postFunc = {
'tech/apply/new/cron/coin/add/withdraw'
:
cronApplyCtrl
.
addWithdraw
,
//增加新币提现定时器
'tech/apply/new/cron/coin/add/withdraw'
:
cronApplyCtrl
.
addWithdraw
,
//增加新币提现定时器
//运营部-现货-现货数据
//运营部-现货-现货数据
'operate/spot/data/increase/user/list'
:
spotDataCtrl
.
increaseUserList
,
'operate/spot/data/increase/user/list'
:
spotDataCtrl
.
increaseUserList
,
'operate/spot/data/trade/user/list'
:
spotDataCtrl
.
tradeUserList
,
//TODO
'operate/spot/data/trade/user/list'
:
spotDataCtrl
.
tradeUserList
,
'operate/spot/data/active/user/list'
:
spotDataCtrl
.
activeUserList
,
'operate/spot/data/active/user/list'
:
spotDataCtrl
.
activeUserList
,
'operate/spot/data/user/deposit/list'
:
spotDataCtrl
.
userDepositList
,
'operate/spot/data/user/deposit/list'
:
spotDataCtrl
.
userDepositList
,
'operate/spot/data/user/withdraw/list'
:
spotDataCtrl
.
userWithdrawList
,
'operate/spot/data/user/withdraw/list'
:
spotDataCtrl
.
userWithdrawList
,
...
...
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