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
e1a73714
Commit
e1a73714
authored
Dec 13, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实时充提
parent
0798fe4a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
6 deletions
+65
-6
README.md
README.md
+2
-0
assetCheck.control.ts
src/functional/mvc/control/v2/assetCheck.control.ts
+2
-5
assetCheck.service.ts
src/functional/mvc/service/v2/assetCheck.service.ts
+61
-1
No files found.
README.md
View file @
e1a73714
## ts 项目说明
## ts 项目说明
v1 是 Madex 管理后台相关接口
v2 是资产管理后台相关接口
1.
dao / common 等基础库和 js 使用同一套,后续基础库都用 ts 重构
1.
dao / common 等基础库和 js 使用同一套,后续基础库都用 ts 重构
2.
业务服务的编码风格暂时保持和 js 风格相同
2.
业务服务的编码风格暂时保持和 js 风格相同
3.
目前的 ts-dao 和 demo 项目代码风格都是是为了兼容 bibox 和 broker 中大量 js 代码。这样迁移的成本最低
3.
目前的 ts-dao 和 demo 项目代码风格都是是为了兼容 bibox 和 broker 中大量 js 代码。这样迁移的成本最低
...
...
src/functional/mvc/control/v2/assetCheck.control.ts
View file @
e1a73714
...
@@ -71,7 +71,7 @@ export const depositList = async (req: any, commonParam: CommonParam) => {
...
@@ -71,7 +71,7 @@ export const depositList = async (req: any, commonParam: CommonParam) => {
let
func_name
=
"assetCheck.control.depositList"
;
let
func_name
=
"assetCheck.control.depositList"
;
try
{
try
{
setPageAndSize
(
commonParam
);
setPageAndSize
(
commonParam
);
let
res
=
await
assetCheckService
.
siteAssets
(
commonParam
.
page
,
commonParam
.
size
);
let
res
=
await
assetCheckService
.
depositList
(
commonParam
.
page
,
commonParam
.
size
,
commonParam
.
uid_or_addr
);
return
Res3Utils
.
result
(
res
);
return
Res3Utils
.
result
(
res
);
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -90,7 +90,7 @@ export const withdrawList = async (req: any, commonParam: CommonParam) => {
...
@@ -90,7 +90,7 @@ export const withdrawList = async (req: any, commonParam: CommonParam) => {
let
func_name
=
"assetCheck.control.withdrawList"
;
let
func_name
=
"assetCheck.control.withdrawList"
;
try
{
try
{
setPageAndSize
(
commonParam
);
setPageAndSize
(
commonParam
);
let
res
=
await
assetCheckService
.
siteAssets
(
commonParam
.
page
,
commonParam
.
size
);
let
res
=
await
assetCheckService
.
withdrawList
(
commonParam
.
page
,
commonParam
.
size
,
commonParam
.
uid_or_addr
);
return
Res3Utils
.
result
(
res
);
return
Res3Utils
.
result
(
res
);
}
}
catch
(
e
)
{
catch
(
e
)
{
...
@@ -99,9 +99,6 @@ export const withdrawList = async (req: any, commonParam: CommonParam) => {
...
@@ -99,9 +99,6 @@ export const withdrawList = async (req: any, commonParam: CommonParam) => {
}
}
};
};
function
setUidOrAddr
(
commonParam
:
CommonParam
){
}
src/functional/mvc/service/v2/assetCheck.service.ts
View file @
e1a73714
import
{
madAdminOrmDB
,
coinAddress
,
coinType
,
mainUserAsset
,
dwdSpotAssetsApi
,
ormDB
}
from
"@madex/ex-ts-dao"
;
import
{
madAdminOrmDB
,
coinAddress
,
coinType
,
mainUserAsset
,
dwdSpotAssetsApi
,
ormDB
,
coinTx
,
coinWithdraw
}
from
"@madex/ex-ts-dao"
;
import
{
getOneAbkUserByAccount
,
getOneAbkUserByUid
,
checkAbkTotp
}
from
"../../../../utils/abkUserUtils"
;
import
{
getOneAbkUserByAccount
,
getOneAbkUserByUid
,
checkAbkTotp
}
from
"../../../../utils/abkUserUtils"
;
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
import
{
ErrorCode
}
from
"../../../../constant/errorCode"
;
import
{
AbkUserInfoConst
}
from
"../../../../constant/abkUserConstant"
;
import
{
AbkUserInfoConst
}
from
"../../../../constant/abkUserConstant"
;
...
@@ -123,6 +123,66 @@ export async function siteAssets(page: any, size: any) {
...
@@ -123,6 +123,66 @@ export async function siteAssets(page: any, size: any) {
return
pageData
;
return
pageData
;
}
}
export
async
function
depositList
(
page
:
any
,
size
:
any
,
uid_or_addr
:
any
)
{
let
where
:
any
;
if
(
!
isNaN
(
Number
(
uid_or_addr
)))
{
where
=
{
[
ormDB
.
Op
.
or
]:
{
user_id
:
Number
(
uid_or_addr
),
to
:
String
(
uid_or_addr
)
}
}
}
else
{
where
=
{
to
:
String
(
uid_or_addr
)
}
}
let
pageData
=
await
coinTx
.
prototype
.
findAndCount
({
attributes
:
[
'user_id'
,
'coin_id'
,
'coin_symbol'
,
'amount'
,
'to'
,
'status'
,
'updatedAt'
],
where
:
where
,
limit
:
size
,
offset
:
(
page
-
1
)
*
size
,
order
:
[[
'updatedAt'
,
'desc'
]],
raw
:
true
});
let
coinIds
=
pageData
.
rows
.
map
(
item
=>
item
.
coin_id
);
let
coinTypeMap
=
await
getCoinTypeMapByCoinOrAssetIds
(
coinIds
,
[]);
for
(
let
item
of
pageData
.
rows
)
{
item
.
chain_type
=
coinTypeMap
[
item
.
coin_id
]
?
coinTypeMap
[
item
.
coin_id
].
chain_type
:
""
}
return
pageData
}
export
async
function
withdrawList
(
page
:
any
,
size
:
any
,
uid_or_addr
:
any
)
{
let
where
:
any
;
if
(
!
isNaN
(
Number
(
uid_or_addr
)))
{
where
=
{
[
ormDB
.
Op
.
or
]:
{
user_id
:
Number
(
uid_or_addr
),
to_address
:
String
(
uid_or_addr
)
}
}
}
else
{
where
=
{
to_address
:
String
(
uid_or_addr
)
}
}
let
pageData
=
await
coinWithdraw
.
prototype
.
findAndCount
({
attributes
:
[
'user_id'
,
'coin_id'
,
'coin_symbol'
,
'amount'
,
'to_address'
,
'status'
,
'updatedAt'
],
where
:
where
,
limit
:
size
,
offset
:
(
page
-
1
)
*
size
,
order
:
[[
'updatedAt'
,
'desc'
]],
raw
:
true
});
let
coinIds
=
pageData
.
rows
.
map
(
item
=>
item
.
coin_id
);
let
coinTypeMap
=
await
getCoinTypeMapByCoinOrAssetIds
(
coinIds
,
[]);
for
(
let
item
of
pageData
.
rows
)
{
item
.
chain_type
=
coinTypeMap
[
item
.
coin_id
]
?
coinTypeMap
[
item
.
coin_id
].
chain_type
:
""
}
return
pageData
}
async
function
getCoinTypeMapByCoinOrAssetIds
(
coin_ids
:
any
[],
asset_ids
?:
any
[])
{
async
function
getCoinTypeMapByCoinOrAssetIds
(
coin_ids
:
any
[],
asset_ids
?:
any
[])
{
let
map
:
any
=
{};
let
map
:
any
=
{};
...
...
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