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
a892a03e
Commit
a892a03e
authored
Sep 30, 2024
by
ml
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
a5b9e71b
beaf9704
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
coinAndPairSetting.ts
cron/coinAndPairSetting.ts
+29
-7
No files found.
cron/coinAndPairSetting.ts
View file @
a892a03e
...
@@ -22,7 +22,8 @@ let job = schedule.scheduleJob('*/15 * * * * ?', async function () {
...
@@ -22,7 +22,8 @@ let job = schedule.scheduleJob('*/15 * * * * ?', async function () {
await
syncCoin
();
await
syncCoin
();
running
=
true
;
running
=
true
;
logger
.
info
(
"coinAndPair sync job finish"
);
logger
.
info
(
"coinAndPair sync job finish"
);
}
catch
(
e
)
{
}
catch
(
e
)
{
logger
.
info
(
e
)
logger
.
info
(
e
)
}
}
running
=
false
;
running
=
false
;
...
@@ -33,8 +34,8 @@ const syncPair = async () => {
...
@@ -33,8 +34,8 @@ const syncPair = async () => {
let
now
=
new
Date
();
let
now
=
new
Date
();
let
res
=
await
spotPairs
.
prototype
.
findAll
({
let
res
=
await
spotPairs
.
prototype
.
findAll
({
where
:
{
where
:
{
status
:
1
,
status
:
1
,
updatedAt
:
{[
ormDB
.
Op
.
lt
]:
new
Date
(
now
.
getTime
()
-
10
*
1000
)
}
// 10秒之前的
updatedAt
:
{
[
ormDB
.
Op
.
lt
]:
new
Date
(
now
.
getTime
()
-
10
*
1000
)
}
// 10秒之前的
},
},
raw
:
true
raw
:
true
})
})
...
@@ -57,6 +58,8 @@ const syncPair = async () => {
...
@@ -57,6 +58,8 @@ const syncPair = async () => {
logger
.
info
(
symbol
,
"sync config success"
)
logger
.
info
(
symbol
,
"sync config success"
)
}
}
}
}
}
}
...
@@ -64,15 +67,15 @@ const syncCoin = async () => {
...
@@ -64,15 +67,15 @@ const syncCoin = async () => {
let
now
=
new
Date
();
let
now
=
new
Date
();
let
res
=
await
coinType
.
prototype
.
findAll
({
let
res
=
await
coinType
.
prototype
.
findAll
({
where
:
{
where
:
{
is_main
:
1
,
is_main
:
1
,
main_status
:
1
,
main_status
:
1
,
updatedAt
:
{[
ormDB
.
Op
.
lt
]:
new
Date
(
now
.
getTime
()
-
10
*
1000
)
}
// 10秒之前的
updatedAt
:
{
[
ormDB
.
Op
.
lt
]:
new
Date
(
now
.
getTime
()
-
10
*
1000
)
}
// 10秒之前的
},
},
raw
:
true
raw
:
true
})
})
for
(
const
coin
of
res
)
{
for
(
const
coin
of
res
)
{
const
{
general_name
:
symbol
,
id
}
=
coin
;
const
{
general_name
:
symbol
,
id
}
=
coin
;
let
cfg
=
await
getCoinFromCore
(
symbol
);
let
cfg
=
await
getCoinFromCore
(
symbol
);
if
(
cfg
)
{
if
(
cfg
)
{
await
coinType
.
prototype
.
update
({
await
coinType
.
prototype
.
update
({
...
@@ -84,6 +87,25 @@ const syncCoin = async () => {
...
@@ -84,6 +87,25 @@ const syncCoin = async () => {
logger
.
info
(
symbol
,
"sync config success"
)
logger
.
info
(
symbol
,
"sync config success"
)
}
}
}
}
// 更新is_main等于0的状态
let
dbsyncres
=
await
coinType
.
prototype
.
findAll
({
attributes
:
[
'general_name'
,
'asset_id'
],
where
:
{
is_main
:
1
,
main_status
:
2
,
},
raw
:
true
})
for
(
const
coin
of
dbsyncres
)
{
await
coinType
.
prototype
.
update
({
main_status
:
2
,
asset_id
:
coin
.
asset_id
},
{
where
:
{
general_name
:
coin
.
general_name
,
is_main
:
0
,
main_status
:
0
}
})
}
}
}
...
...
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