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
fa922b88
Commit
fa922b88
authored
Dec 12, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
收入分析
parent
5e3bc186
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
470 additions
and
23 deletions
+470
-23
abkFeeStatistics.control.ts
src/functional/mvc/control/v2/abkFeeStatistics.control.ts
+68
-0
assetCheck.control.ts
src/functional/mvc/control/v2/assetCheck.control.ts
+4
-8
abkCommonService.ts
src/functional/mvc/service/v2/abkCommonService.ts
+26
-0
abkFeeStatistics.service.ts
src/functional/mvc/service/v2/abkFeeStatistics.service.ts
+290
-0
assetCheck.service.ts
src/functional/mvc/service/v2/assetCheck.service.ts
+77
-15
index.ts
src/functional/router/v2/index.ts
+5
-0
No files found.
src/functional/mvc/control/v2/abkFeeStatistics.control.ts
0 → 100644
View file @
fa922b88
import
*
as
abkFeeStatisticsService
from
"../../service/v2/abkFeeStatistics.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
import
{
beforeQueryCheckTime
,
CommonParam
,
setPageAndSize
}
from
"../../service/v2/abkCommonService"
;
/**
* 首页数据概览
* @param req
* @param commonParam
*/
export
const
gatherData
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"abkFeeStatistics.control.gatherData"
;
try
{
beforeQueryCheckTime
(
commonParam
);
let
res
=
await
abkFeeStatisticsService
.
gatherData
(
commonParam
.
from_time
,
commonParam
.
to_time
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 查询手续费数据
* type 1 现货 2 U本位合约 3 币本位合约 4 全部
* @param req
* @param commonParam
*/
export
const
getFeeData
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"abkFeeStatistics.control.getFeeData"
;
try
{
setPageAndSize
(
commonParam
);
beforeQueryCheckTime
(
commonParam
);
let
type
=
Number
(
commonParam
.
query_type
)
||
4
;
let
res
=
await
abkFeeStatisticsService
.
getFeeData
(
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
);
}
};
/**
* 提现手续费
* @param req
* @param commonParam
*/
export
const
withdrawData
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"abkFeeStatistics.control.withdrawData"
;
try
{
setPageAndSize
(
commonParam
);
beforeQueryCheckTime
(
commonParam
);
let
res
=
await
abkFeeStatisticsService
.
withdrawData
(
commonParam
.
from_time
,
commonParam
.
to_time
,
commonParam
.
page
,
commonParam
.
size
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/control/v2/assetCheck.control.ts
View file @
fa922b88
import
*
as
assetCheckService
from
"../../service/v2/assetCheck.service"
;
import
{
CommonParam
}
from
"../../service/v2/assetCheck.s
ervice"
;
import
{
CommonParam
,
setPageAndSize
}
from
"../../service/v2/abkCommonS
ervice"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
...
...
@@ -28,14 +28,14 @@ export const userAddrList = async (req: any, commonParam: CommonParam) => {
* @param commonParam
*/
export
const
assetDetails
=
async
(
req
:
any
,
commonParam
:
CommonParam
)
=>
{
let
func_name
=
"assetCheck.control.
userAddrList
"
;
let
func_name
=
"assetCheck.control.
assetDetails
"
;
try
{
setPageAndSize
(
commonParam
);
if
(
!
commonParam
.
user_id
){
throw
ErrorCode
.
PARAM_MISS
;
}
// let res = await assetCheckService.assetDetails(commonParam.page, commonParam.size,
commonParam.user_id);
//
return Res3Utils.result(res);
let
res
=
await
assetCheckService
.
assetDetails
(
commonParam
.
user_id
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
...
...
@@ -43,9 +43,5 @@ export const assetDetails = async (req: any, commonParam: CommonParam) => {
}
};
function
setPageAndSize
(
commonParam
:
CommonParam
)
{
commonParam
.
page
=
commonParam
.
page
?
Number
(
commonParam
.
page
)
:
1
;
commonParam
.
size
=
commonParam
.
size
?
Number
(
commonParam
.
size
)
:
20
;
}
src/functional/mvc/service/v2/abkCommonService.ts
0 → 100644
View file @
fa922b88
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
export
interface
CommonParam
{
user_id
?:
number
;
page
?:
number
,
size
?:
number
,
from_time
?:
any
,
to_time
?:
any
,
query_type
?:
number
//查询类型 1 现货 2 U本位合约 3 币本位合约 4 全部
}
export
function
setPageAndSize
(
commonParam
:
CommonParam
)
{
commonParam
.
page
=
commonParam
.
page
?
Number
(
commonParam
.
page
)
:
1
;
commonParam
.
size
=
commonParam
.
size
?
Number
(
commonParam
.
size
)
:
20
;
}
export
function
beforeQueryCheckTime
(
commonParam
:
CommonParam
)
{
if
(
!
commonParam
.
from_time
||
!
commonParam
.
to_time
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
}
\ No newline at end of file
src/functional/mvc/service/v2/abkFeeStatistics.service.ts
0 → 100644
View file @
fa922b88
import
{
madAdminOrmDB
,
coinAddress
,
coinType
,
abkFeeStatistics
,
ormDB
,
coinWithdraw
}
from
"@madex/ex-ts-dao"
;
import
BigNumber
from
"bignumber.js"
;
import
{
any
}
from
"async"
;
const
Otplib
=
require
(
'otplib'
);
let
{
logger
,
apiAssertUtils
:
ApiAssert
,
BigNumberUtils
}
=
require
(
'@madex/ex-js-public'
);
let
{
authCommon
:
AuthCommon
,
redisUtilsCommon
:
RedisClient
,
tickerUtils
}
=
require
(
'@madex/ex-js-common'
);
let
_
=
require
(
'lodash'
);
/**
* 首页数据概览
* @param from_time
* @param to_time
*/
export
async
function
gatherData
(
from_time
:
any
,
to_time
:
any
)
{
let
where
:
any
=
{
[
ormDB
.
Op
.
and
]:
[
{
trade_date
:
{
[
ormDB
.
Op
.
gte
]:
from_time
}
},
{
trade_date
:
{
[
ormDB
.
Op
.
lt
]:
to_time
},
}]
}
let
condition
:
any
=
{
[
ormDB
.
Op
.
and
]:
[
{
createdAt
:
{
[
ormDB
.
Op
.
gte
]:
from_time
}
},
{
createdAt
:
{
[
ormDB
.
Op
.
lt
]:
to_time
},
}],
status
:
3
//发币完成
}
//手续费和返佣
let
task1
=
abkFeeStatistics
.
prototype
.
findAll
({
attributes
:
[
'user_type'
,
ormDB
.
literal
(
'sum(spot_fee_usdt) as spot_fee_usdt'
),
ormDB
.
literal
(
'sum(lpc_fee_usdt) as lpc_fee_usdt'
),
ormDB
.
literal
(
'sum(ipc_fee_usdt) as ipc_fee_usdt'
),
ormDB
.
literal
(
'sum(spot_back_usdt) as spot_back_usdt'
),
ormDB
.
literal
(
'sum(lpc_back_usdt) as lpc_back_usdt'
),
ormDB
.
literal
(
'sum(ipc_back_usdt) as ipc_back_usdt'
)
],
where
:
where
,
group
:
[
'user_type'
],
order
:
[[
'user_type'
,
'asc'
]],
raw
:
true
});
let
[
dbFeeList
,
{
total_withdraw_fee
,
tickerMap
}]
=
await
Promise
.
all
([
task1
,
getTotalWithdrawFeeByCondition
(
condition
)]);
//普通用户数据
let
commonData
=
dbFeeList
[
0
]
?
dbFeeList
[
0
]
:
{};
//代理用户(crm)用户数据
let
crmData
=
dbFeeList
[
1
]
?
dbFeeList
[
1
]
:
{};
let
spot_data
=
buildOneResult
(
commonData
.
spot_fee_usdt
,
commonData
.
spot_back_usdt
,
crmData
.
spot_fee_usdt
,
crmData
.
spot_back_usdt
);
let
lpc_data
=
buildOneResult
(
commonData
.
lpc_fee_usdt
,
commonData
.
lpc_back_usdt
,
crmData
.
lpc_fee_usdt
,
crmData
.
lpc_back_usdt
);
let
ipc_data
=
buildOneResult
(
commonData
.
ipc_fee_usdt
,
commonData
.
ipc_back_usdt
,
crmData
.
ipc_fee_usdt
,
crmData
.
ipc_back_usdt
);
let
all_common_fee
=
new
BigNumber
(
commonData
.
spot_fee_usdt
).
add
(
new
BigNumber
(
commonData
.
lpc_fee_usdt
)).
add
(
new
BigNumber
(
commonData
.
ipc_fee_usdt
));
let
all_common_back
=
new
BigNumber
(
commonData
.
spot_back_usdt
).
add
(
new
BigNumber
(
commonData
.
lpc_back_usdt
)).
add
(
new
BigNumber
(
commonData
.
ipc_back_usdt
));
let
all_crm_fee
=
new
BigNumber
(
crmData
.
spot_fee_usdt
).
add
(
new
BigNumber
(
crmData
.
lpc_fee_usdt
)).
add
(
new
BigNumber
(
crmData
.
ipc_fee_usdt
));
let
all_crm_back
=
new
BigNumber
(
crmData
.
spot_back_usdt
).
add
(
new
BigNumber
(
crmData
.
ipc_back_usdt
)).
add
(
new
BigNumber
(
crmData
.
ipc_back_usdt
));
let
all_data
=
buildOneResult
(
all_common_fee
,
all_common_back
,
all_crm_fee
,
all_crm_back
);
//总手续费+提现手续费
all_data
.
total_fee
=
all_data
.
total_fee
.
add
(
total_withdraw_fee
);
return
{
all_data
,
spot_data
,
lpc_data
,
ipc_data
,
withdraw_data
:
total_withdraw_fee
}
}
/**
* 手续费数据
* @param from_time
* @param to_time
* @param page
* @param size
* @param type 1 现货 2 U本位合约 3 币本位合约 4 全部
*/
export
async
function
getFeeData
(
from_time
:
any
,
to_time
:
any
,
page
:
any
,
size
:
any
,
type
:
number
)
{
let
[
total_obj
,
pageData
]
=
await
Promise
.
all
([
getTotalFeeDataOfPeriodByType
(
from_time
,
to_time
,
type
),
getTotalFeePageDataOfPeriodByType
(
page
,
size
,
from_time
,
to_time
,
type
)]);
pageData
[
"total_data"
]
=
total_obj
;
return
pageData
;
}
/**
* 提现手续费数据
* @param from_time
* @param to_time
* @param page
* @param size
*/
export
async
function
withdrawData
(
from_time
:
any
,
to_time
:
any
,
page
:
any
,
size
:
any
)
{
let
where
:
any
=
{
[
ormDB
.
Op
.
and
]:
[
{
createdAt
:
{
[
ormDB
.
Op
.
gte
]:
from_time
}
},
{
createdAt
:
{
[
ormDB
.
Op
.
lt
]:
to_time
},
}],
status
:
3
}
let
task2
=
coinWithdraw
.
prototype
.
findAndCount
({
attributes
:
[
'coin_symbol'
,
'amount'
,
'fee'
,
'status'
],
where
:
where
,
limit
:
Number
(
size
),
offset
:
(
Number
(
page
)
-
1
)
*
Number
(
size
),
order
:
[[
'updatedAt'
,
'desc'
]],
raw
:
true
});
let
[{
total_withdraw_fee
,
tickerMap
},
pageData
]
=
await
Promise
.
all
([
getTotalWithdrawFeeByCondition
(
where
),
task2
]);
for
(
let
item
of
pageData
.
rows
)
{
item
.
amount_usdt
=
new
BigNumber
(
item
.
amount
).
mul
(
new
BigNumber
(
tickerMap
[
item
.
coin_symbol
]
||
0
));
item
.
fee_usdt
=
new
BigNumber
(
item
.
fee
).
mul
(
new
BigNumber
(
tickerMap
[
item
.
coin_symbol
]
||
0
));
}
pageData
[
'total_withdraw_fee'
]
=
total_withdraw_fee
;
return
pageData
;
}
function
buildOneResult
(
common_fee
:
any
,
common_back
:
any
,
crm_fee
:
any
,
crm_back
:
any
)
{
return
{
total_fee
:
new
BigNumber
(
common_fee
||
0
).
add
(
new
BigNumber
(
crm_fee
||
0
)),
total_back
:
new
BigNumber
(
common_back
||
0
).
add
(
new
BigNumber
(
crm_back
||
0
)),
common_user
:
{
fee
:
new
BigNumber
(
common_fee
||
0
),
back
:
new
BigNumber
(
common_back
||
0
)
},
crm_user
:
{
fee
:
new
BigNumber
(
crm_fee
||
0
),
back
:
new
BigNumber
(
crm_back
||
0
),
}
}
}
/**
* 根据类型查询一段时间内的总手续费
* @param from_time
* @param to_time
* @param type 1 现货 2 U本位合约 3 币本位合约 4 全部
*/
async
function
getTotalFeeDataOfPeriodByType
(
from_time
:
any
,
to_time
:
any
,
type
:
number
)
{
let
where
:
any
=
{
[
ormDB
.
Op
.
and
]:
[
{
trade_date
:
{
[
ormDB
.
Op
.
gte
]:
from_time
}
},
{
trade_date
:
{
[
ormDB
.
Op
.
lt
]:
to_time
},
}]
}
let
{
fee_field
,
back_field
}
=
getFields
(
type
);
let
dbList
=
await
abkFeeStatistics
.
prototype
.
findAll
({
attributes
:
[
'user_type'
,
ormDB
.
literal
(
`sum(\`
${
fee_field
}
\`) as total_fee_usdt`
),
ormDB
.
literal
(
`sum(\`
${
back_field
}
\`) as total_back_usdt`
),
],
where
:
where
,
group
:
[
'user_type'
],
order
:
[[
'user_type'
,
'asc'
]],
raw
:
true
});
let
commonUserData
=
dbList
[
0
]
?
dbList
[
0
]
:
{};
let
crmUserData
=
dbList
[
1
]
?
dbList
[
1
]
:
{};
return
buildOneResult
(
commonUserData
.
total_fee_usdt
,
commonUserData
.
total_back_usdt
,
crmUserData
.
total_fee_usdt
,
crmUserData
.
total_back_usdt
);
}
/**
* 根据类型 查询一段时间内的手续费 分页数据
* @param page
* @param size
* @param from_time
* @param to_time
* @param type 1 现货 2 U本位合约 3 币本位合约 4 全部
*/
async
function
getTotalFeePageDataOfPeriodByType
(
page
:
any
,
size
:
any
,
from_time
:
any
,
to_time
:
any
,
type
:
number
)
{
let
res
:
any
;
let
where
:
any
=
{
[
ormDB
.
Op
.
and
]:
[
{
trade_date
:
{
[
ormDB
.
Op
.
gte
]:
from_time
}
},
{
trade_date
:
{
[
ormDB
.
Op
.
lt
]:
to_time
},
}]
}
let
{
fee_field
,
back_field
}
=
getFields
(
type
);
res
=
await
abkFeeStatistics
.
prototype
.
findAndCount
({
attributes
:
[
'trade_date'
,
'user_type'
,
ormDB
.
literal
(
`sum(\`
${
fee_field
}
\`) as total_fee_usdt`
),
ormDB
.
literal
(
`sum(\`
${
back_field
}
\`) as total_back_usdt`
),
],
where
:
where
,
limit
:
Number
(
size
),
offset
:
(
Number
(
page
)
-
1
)
*
Number
(
size
),
group
:
[
'trade_date'
,
'user_type'
],
order
:
[[
'trade_date'
,
'desc'
],
[
'user_type'
,
'asc'
]],
raw
:
true
});
res
.
count
=
res
.
count
.
length
;
return
res
;
}
/**
* 根据类型获取要查询的字段
* @param type
*/
function
getFields
(
type
:
number
)
{
let
fee_field
=
""
;
let
back_field
=
""
;
switch
(
type
)
{
case
1
:
fee_field
=
"spot_fee_usdt"
;
back_field
=
"spot_back_usdt"
;
break
;
case
2
:
fee_field
=
"lpc_fee_usdt"
;
back_field
=
"lpc_back_usdt"
;
break
;
case
3
:
fee_field
=
"ipc_fee_usdt"
;
back_field
=
"ipc_back_usdt"
;
break
;
default
:
// 这里拼接字符串 注意 ` 符号
fee_field
=
"spot_fee_usdt` + `lpc_fee_usdt` + `ipc_fee_usdt"
;
back_field
=
"spot_back_usdt` + `lpc_back_usdt` + `ipc_back_usdt"
;
break
;
}
return
{
fee_field
,
back_field
}
}
/**
* 根据条件查询总提现手续费
* @param where
*/
async
function
getTotalWithdrawFeeByCondition
(
where
:
any
)
{
//提现手续费
let
dbList
=
await
coinWithdraw
.
prototype
.
findAll
({
attributes
:
[
'coin_symbol'
,
ormDB
.
literal
(
'sum(fee) as fee'
)
],
where
:
where
,
group
:
[
'coin_symbol'
],
raw
:
true
});
let
tickerMap
=
{};
let
total_withdraw_fee
=
new
BigNumber
(
0
);
for
(
let
item
of
dbList
)
{
let
usdt
=
await
tickerUtils
.
rateCoin2USDT
(
item
.
coin_symbol
);
let
fee_usdt
=
new
BigNumber
(
item
.
fee
).
mul
(
new
BigNumber
(
usdt
));
total_withdraw_fee
=
total_withdraw_fee
.
add
(
fee_usdt
);
tickerMap
[
item
.
coin_symbol
]
=
usdt
;
}
return
{
total_withdraw_fee
,
tickerMap
}
}
src/functional/mvc/service/v2/assetCheck.service.ts
View file @
fa922b88
import
{
madAdminOrmDB
,
coinAddress
,
coinType
}
from
"@madex/ex-ts-dao"
;
import
{
madAdminOrmDB
,
coinAddress
,
coinType
,
mainUserAsset
,
dwdSpotAssetsApi
}
from
"@madex/ex-ts-dao"
;
import
{
getOneAbkUserByAccount
,
getOneAbkUserByUid
,
checkAbkTotp
}
from
"../../../../utils/abkUserUtils"
;
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
import
{
AbkUserInfoConst
}
from
"../../../../constant/abkUserConstant"
;
import
{
CryptUtils
}
from
"../../../../utils/crypt-utils"
;
import
{
RedisVal
}
from
"../../../../constant/redis-val"
;
import
Config
from
"../../../../../config"
;
import
BigNumber
from
"bignumber.js"
;
const
Otplib
=
require
(
'otplib'
);
...
...
@@ -13,14 +14,6 @@ let { authCommon: AuthCommon, redisUtilsCommon: RedisClient, } = require('@madex
let
_
=
require
(
'lodash'
);
export
interface
CommonParam
{
user_id
?:
number
;
page
?:
number
,
size
?:
number
}
export
async
function
userAddrList
(
page
:
any
,
size
:
any
,
user_id
:
any
)
{
let
where
:
any
=
{};
...
...
@@ -37,7 +30,7 @@ export async function userAddrList(page: any, size: any, user_id: any) {
});
if
(
res
.
rows
.
length
)
{
let
coinIds
=
res
.
rows
.
map
(
item
=>
item
.
coin_id
);
let
coinMap
=
await
getCoinTypeMapByCoinIds
(
coinIds
);
let
coinMap
=
await
getCoinTypeMapByCoin
OrAsset
Ids
(
coinIds
);
for
(
let
item
of
res
.
rows
)
{
item
.
chain_type
=
coinMap
[
item
.
coin_id
].
chain_type
;
item
.
coin_symbol
=
coinMap
[
item
.
coin_id
].
symbol
;
...
...
@@ -46,18 +39,87 @@ export async function userAddrList(page: any, size: any, user_id: any) {
return
res
;
}
export
async
function
assetDetails
(
user_id
:
any
)
{
let
where
:
any
=
{};
where
[
"user_id"
]
=
Number
(
user_id
);
let
assets_map
:
any
=
{};
let
asset_id_list
:
any
=
[];
let
task1
=
mainUserAsset
.
prototype
.
findAll
({
attributes
:
[
'asset_id'
,
'symbol'
,
'balance'
,
'holds'
],
where
:
where
,
raw
:
true
});
let
task2
=
dwdSpotAssetsApi
.
prototype
.
findAll
({
attributes
:
[
'asset_id'
,
'asset_symbol'
,
'balance'
,
'unreal_profit'
],
where
:
where
,
raw
:
true
});
let
[
dbMainAssets
,
dbTradeAssets
]
=
await
Promise
.
all
([
task1
,
task2
]);
for
(
let
item
of
dbMainAssets
)
{
let
total
=
new
BigNumber
(
item
.
balance
).
add
(
new
BigNumber
(
item
.
holds
));
assets_map
[
item
.
asset_id
]
=
assets_map
[
item
.
asset_id
]
?
assets_map
[
item
.
asset_id
].
add
(
total
)
:
total
;
if
(
!
asset_id_list
.
includes
(
item
.
asset_id
))
{
asset_id_list
.
push
(
item
.
asset_id
);
}
}
for
(
let
item
of
dbTradeAssets
)
{
let
total
=
new
BigNumber
(
item
.
balance
).
add
(
new
BigNumber
(
item
.
unreal_profit
));
assets_map
[
item
.
asset_id
]
=
assets_map
[
item
.
asset_id
]
?
assets_map
[
item
.
asset_id
].
add
(
total
)
:
total
;
if
(
!
asset_id_list
.
includes
(
item
.
asset_id
))
{
asset_id_list
.
push
(
item
.
asset_id
);
}
}
let
coinMap
=
await
getCoinTypeMapByCoinOrAssetIds
([],
asset_id_list
);
let
asset_keys
=
_
.
keys
(
assets_map
);
let
res
:
any
=
[];
for
(
let
assetKey
of
asset_keys
)
{
let
balance
=
assets_map
[
Number
(
assetKey
)];
let
symbol
=
coinMap
[
Number
(
assetKey
)]
?
coinMap
[
Number
(
assetKey
)].
symbol
:
""
;
let
chain_type
=
coinMap
[
Number
(
assetKey
)]
?
coinMap
[
Number
(
assetKey
)].
chain_type
:
""
;
res
.
push
({
chain_type
,
symbol
,
balance
});
}
return
res
;
}
async
function
getCoinTypeMapByCoin
Ids
(
coin_ids
:
any
[])
{
async
function
getCoinTypeMapByCoin
OrAssetIds
(
coin_ids
:
any
[],
asset_ids
?
:
any
[])
{
let
map
:
any
=
{};
let
where
:
any
=
{};
let
coin_id_flag
=
false
;
if
(
coin_ids
.
length
)
{
where
[
"id"
]
=
coin_ids
;
coin_id_flag
=
true
;
}
else
{
where
[
"asset_id"
]
=
asset_ids
;
}
let
dbList
=
await
coinType
.
prototype
.
findAll
({
where
:
{
id
:
coin_ids
},
where
:
where
,
raw
:
true
});
for
(
let
item
of
dbList
)
{
map
[
item
.
id
]
=
item
;
if
(
coin_id_flag
)
{
map
[
item
.
id
]
=
item
;
}
else
{
map
[
item
.
asset_id
]
=
item
;
}
}
return
map
;
}
...
...
src/functional/router/v2/index.ts
View file @
fa922b88
...
...
@@ -12,6 +12,7 @@ const router = Express.Router();
import
*
as
abkUserCtrl
from
"../../mvc/control/v2/abkUserInfo.control"
;
import
*
as
assetCheckCtrl
from
"../../mvc/control/v2/assetCheck.control"
;
import
*
as
feeStatisticsCtrl
from
"../../mvc/control/v2/abkFeeStatistics.control"
;
import
Config
from
"../../../../config"
;
...
...
@@ -30,6 +31,10 @@ const postFunc = {
'assetCheck/userAddrList'
:
assetCheckCtrl
.
userAddrList
,
'assetCheck/assetDetails'
:
assetCheckCtrl
.
assetDetails
,
'assetCheck/depositAndWithDraw'
:
assetCheckCtrl
.
assetDetails
,
//收入分析
'abkFeeStatistics/home/gatherData'
:
feeStatisticsCtrl
.
gatherData
,
'abkFeeStatistics/getFeeData'
:
feeStatisticsCtrl
.
getFeeData
,
'abkFeeStatistics/withdrawData'
:
feeStatisticsCtrl
.
withdrawData
,
/*
'user/login/confirm': userOptCtrl.loginConfirm,
'user/bind/totp/ask': userOptCtrl.bindTotpAsk,
...
...
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