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
7fa5aef5
Commit
7fa5aef5
authored
Dec 13, 2024
by
1486327116
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a5e65322
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
41 deletions
+39
-41
coinType.service.ts
src/functional/mvc/service/coinType.service.ts
+36
-2
coinTypeApply.service.ts
src/functional/mvc/service/coinTypeApply.service.ts
+3
-0
ws.test.ts
test/ws.test.ts
+0
-39
No files found.
src/functional/mvc/service/coinType.service.ts
View file @
7fa5aef5
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import
{
coinType
,
ormDB
,
spotPairs
,
mixinCoin
}
from
"@madex/ex-ts-dao"
;
import
{
coinType
,
ormDB
,
spotPairs
,
mixinCoin
,
mixinChain
}
from
"@madex/ex-ts-dao"
;
import
{
addCoin2Core
}
from
"../../../utils/coreSystemUtils"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
const
_
=
require
(
"lodash"
);
let
{
logger
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
...
...
@@ -276,12 +277,45 @@ export async function mixinCoinList(param: ListParam) {
where
[
"symbol"
]
=
{
[
ormDB
.
Op
.
like
]:
`%
${
param
.
symbol
}
%`
};
}
let
resList
=
await
mixinCoin
.
prototype
.
findAndCount
({
attributes
:[
'symbol'
,
'name'
,
'symbol_id'
,
'display_symbol'
,
'chain_id'
,
'address'
,
'precision'
,
'dust'
,
'confirm'
,
'price_btc'
,
'price_usd'
,
'balance'
,
'comment'
],
attributes
:[
'symbol'
,
'name'
,
'symbol_id'
,[
'symbol_id'
,
'mixin_id'
],
'display_symbol'
,
'chain_id'
,
[
'address'
,
'contract'
],[
'precision'
,
'original_decimals'
],[
'dust'
,
'deposit_min'
],[
'dust'
,
'withdraw_min'
],
[
'confirm'
,
'deposit_confirm_count'
],[
'confirm'
,
'safe_confirm_count'
],
'price_btc'
,
'price_usd'
,
'balance'
,
'comment'
],
// include:{
// model:mixinChain.prototype,
// required:true, //INNER JOIN
// attributes:['name','symbol','threshold','withdrawal_fee','is_memo'],
// },
where
:
where
,
limit
:
param
.
size
,
offset
:
(
param
.
page
-
1
)
*
param
.
size
,
order
:
[[
"symbol"
,
"asc"
]],
raw
:
true
});
let
chainIDs
=
_
.
map
(
resList
.
rows
,
'chain_id'
)
let
m
=
await
mixinChain
.
prototype
.
findAll
({
attributes
:[
'name'
,
'symbol'
,
'threshold'
,
'withdrawal_fee'
,
'is_memo'
,
'chain_id'
],
where
:{
chain_id
:
chainIDs
},
raw
:
true
,
})
let
chainMap
=
_
.
keyBy
(
m
,
'chain_id'
);
for
(
const
item
of
resList
.
rows
)
{
let
isMainToken
=
(
item
.
symbol_id
==
item
.
chain_id
&&
item
.
chain_id
==
item
.
contract
)
if
(
chainMap
[
item
.
chain_id
])
{
item
.
chain_type
=
chainMap
[
item
.
chain_id
].
symbol
item
.
issupport_memo
=
chainMap
[
item
.
chain_id
].
is_memo
;
item
.
valid_decimals
=
8
;
item
.
withdraw_fee
=
isMainToken
?
chainMap
[
item
.
chain_id
].
withdrawal_fee
:
(
5
/
(
item
.
price_usd
>
0
?
item
.
price_usd
:
0.001
)).
toFixed
(
4
);
}
if
(
item
.
contract
)
{
item
.
is_erc20
=
1
;
}
else
{
item
.
is_erc20
=
0
;
}
}
return
resList
;
}
\ No newline at end of file
src/functional/mvc/service/coinTypeApply.service.ts
View file @
7fa5aef5
...
...
@@ -23,6 +23,7 @@ export interface CoinTypeApplyVO {
chain_type
?:
string
;
issupport_memo
?:
number
;
forbid_info
?:
string
;
...
...
@@ -302,6 +303,8 @@ export async function review(id: any, currentUser: any, ip: string | undefined)
main_status
:
main_status
,
name
:
dbApply
.
name
,
mixin_id
:
dbApply
.
mixin_id
,
issupport_memo
:
dbApply
.
issupport_memo
,
deposit_min
:
dbApply
.
deposit_min
,
general_name
:
dbApply
.
general_name
,
chain_type
:
dbApply
.
chain_type
,
original_decimals
:
dbApply
.
original_decimals
,
...
...
test/ws.test.ts
deleted
100644 → 0
View file @
a5e65322
import
WebSocket
from
'ws'
;
const
client
=
new
WebSocket
(
'ws://127.0.0.1:8443?sid=12312'
,[],{
"headers"
:{
"api-key"
:
111
}});
// 心跳
let
heartbeatInterval
:
any
;
const
heartbeatConfig
=
{
interval
:
30000
,
// 心跳间隔
};
function
heartBeat
(){
console
.
log
(
new
Date
()
+
" send ping..."
)
client
.
ping
()
}
client
.
on
(
'error'
,
console
.
error
);
client
.
on
(
'open'
,
function
open
()
{
console
.
log
(
"success open!"
)
if
(
heartbeatInterval
)
{
clearInterval
(
heartbeatInterval
);
}
heartbeatInterval
=
setInterval
(
heartBeat
,
heartbeatConfig
.
interval
);
// 设置心跳
});
client
.
on
(
'message'
,
function
message
(
data
)
{
console
.
log
(
'received: %s'
,
data
);
});
client
.
on
(
'onclose'
,
function
message
(
data
)
{
if
(
heartbeatInterval
)
{
clearInterval
(
heartbeatInterval
);
// 清除心跳定时器
}
console
.
log
(
'Connection closed'
);
});
client
.
on
(
'pong'
,
function
(){
console
.
log
(
"rec pong"
)
})
\ No newline at end of file
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