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
6f79f66b
Commit
6f79f66b
authored
Nov 20, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
systemTrigger cron 修改
parent
7787904b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
24 deletions
+60
-24
task.system.trigger.service.ts
cron/service/task.system.trigger.service.ts
+60
-24
No files found.
cron/service/task.system.trigger.service.ts
View file @
6f79f66b
...
...
@@ -80,23 +80,24 @@ export const getExPairUnTriggers = async function () {
}
export
const
doExPairTrigger
=
async
function
(
trigId
:
any
,
pair
:
string
,
action
:
any
)
{
let
rtn
:
any
=
false
;
let
rtn
:
any
=
false
;
try
{
let
dbPair
:
any
;
if
(
pair
.
endsWith
(
"_SWAP"
)){
let
dbPair
:
any
;
if
(
pair
.
endsWith
(
"_SWAP"
))
{
dbPair
=
await
contractPairs
.
prototype
.
findOne
({
where
:{
symbol
:
pair
where
:
{
symbol
:
pair
},
raw
:
true
})
;
}
else
{
raw
:
true
});
}
else
{
dbPair
=
await
spotPairs
.
prototype
.
findOne
({
where
:{
symbol
:
pair
where
:
{
symbol
:
pair
},
raw
:
true
})
;
raw
:
true
});
}
if
(
!
dbPair
)
{
...
...
@@ -131,18 +132,19 @@ export const doExPairTrigger = async function (trigId: any, pair: string, action
try
{
console
.
log
(
'start transaction'
);
t
=
await
ormDB
.
transaction
();
if
(
pair
.
endsWith
(
"_SWAP"
)){
await
contractPairs
.
prototype
.
update
(
target_value
,{
where
:{
id
:
dbPair
.
id
if
(
pair
.
endsWith
(
"_SWAP"
))
{
await
contractPairs
.
prototype
.
update
(
target_value
,
{
where
:
{
id
:
dbPair
.
id
},
})
;
}
else
{
await
contractPairs
.
prototype
.
update
(
target_value
,{
where
:{
id
:
dbPair
.
id
});
}
else
{
await
contractPairs
.
prototype
.
update
(
target_value
,
{
where
:
{
id
:
dbPair
.
id
},
})
;
});
}
await
systemTrigger
.
prototype
.
update
({
status
:
TRIGGER_STATUS_SUCCESS
},
{
where
:
{
id
:
trigId
,
status
:
0
},
transaction
:
t
});
await
t
.
commit
();
...
...
@@ -237,8 +239,42 @@ export const doCoinTypeTrigger = async function (trigId: any, coinSymbol: any, a
export
const
updateRedisPairs
=
async
function
()
{
console
.
log
(
'updateRedisPairs'
);
try
{
//let list = await exPair.prototype.findAll({ where: { is_active: 1 } });
// redisUtilsCommon.writeSync(KEY_PAIR_LIST, JSON.stringify(list));
let
task1
=
spotPairs
.
prototype
.
findAll
({
where
:
{
is_active
:
1
},
raw
:
true
,
});
let
task2
=
contractPairs
.
prototype
.
findAll
({
where
:
{
is_active
:
1
},
raw
:
true
,
});
let
[
spotList
,
contractList
]
=
await
Promise
.
all
([
task1
,
task2
]);
let
list
:
any
=
[];
for
(
let
item
of
spotList
)
{
let
temp
=
{
id
:
item
.
id
,
pair
:
item
.
symbol
,
is_hide
:
item
.
is_hide
,
decimal
:
item
.
price_scale
,
amount_scale
:
item
.
quantity_scale
,
}
list
.
push
(
temp
);
}
for
(
let
item
of
contractList
)
{
let
temp
=
{
id
:
item
.
id
,
pair
:
item
.
symbol
,
is_hide
:
item
.
is_hide
,
decimal
:
item
.
price_scale
,
amount_scale
:
item
.
quantity_scale
,
}
list
.
push
(
temp
);
}
redisUtilsCommon
.
writeSync
(
KEY_PAIR_LIST
,
JSON
.
stringify
(
list
));
}
catch
(
e
)
{
console
.
error
(
e
);
...
...
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