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
7787904b
Commit
7787904b
authored
Nov 20, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
systemTrigger cron 修改
parent
f84ae4ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
9 deletions
+33
-9
task.system.trigger.service.ts
cron/service/task.system.trigger.service.ts
+33
-9
No files found.
cron/service/task.system.trigger.service.ts
View file @
7787904b
'use strict'
;
'use strict'
;
import
{
ormDB
,
coinType
,
systemTrigger
}
from
"@madex/ex-ts-dao"
;
import
{
ormDB
,
coinType
,
systemTrigger
,
contractPairs
,
spotPairs
}
from
"@madex/ex-ts-dao"
;
let
{
redisUtilsCommon
}
=
require
(
'@madex/ex-js-common'
)
let
{
redisUtilsCommon
}
=
require
(
'@madex/ex-js-common'
)
...
@@ -79,13 +79,27 @@ export const getExPairUnTriggers = async function () {
...
@@ -79,13 +79,27 @@ export const getExPairUnTriggers = async function () {
}
}
export
const
doExPairTrigger
=
async
function
(
trigId
:
any
,
ex_pair
:
any
,
action
:
any
)
{
export
const
doExPairTrigger
=
async
function
(
trigId
:
any
,
pair
:
string
,
action
:
any
)
{
let
rtn
:
any
=
false
;
let
rtn
:
any
=
false
;
try
{
try
{
//TODO:目前交易对 没有激活 隐藏相关字段了 之后有的话 再补充
let
dbPair
:
any
;
//let pair = await exPair.prototype.findOne({ where: { pair: ex_pair }, raw: true });
if
(
pair
.
endsWith
(
"_SWAP"
)){
let
pair
=
null
;
dbPair
=
await
contractPairs
.
prototype
.
findOne
({
if
(
!
pair
)
{
where
:{
symbol
:
pair
},
raw
:
true
})
;
}
else
{
dbPair
=
await
spotPairs
.
prototype
.
findOne
({
where
:{
symbol
:
pair
},
raw
:
true
})
;
}
if
(
!
dbPair
)
{
//交易对不存在,标记触发失败
//交易对不存在,标记触发失败
await
systemTrigger
.
prototype
.
update
({
status
:
TRIGGER_STATUS_FAIL
},
{
where
:
{
id
:
trigId
,
status
:
0
}
});
await
systemTrigger
.
prototype
.
update
({
status
:
TRIGGER_STATUS_FAIL
},
{
where
:
{
id
:
trigId
,
status
:
0
}
});
rtn
=
false
;
rtn
=
false
;
...
@@ -117,8 +131,19 @@ export const doExPairTrigger = async function (trigId: any, ex_pair: any, action
...
@@ -117,8 +131,19 @@ export const doExPairTrigger = async function (trigId: any, ex_pair: any, action
try
{
try
{
console
.
log
(
'start transaction'
);
console
.
log
(
'start transaction'
);
t
=
await
ormDB
.
transaction
();
t
=
await
ormDB
.
transaction
();
//TODO: 目前交易对 没有激活 隐藏相关字段了 之后有的话 再补充
if
(
pair
.
endsWith
(
"_SWAP"
)){
//await exPair.prototype.update(target_value, { where: { pair: ex_pair }, transaction: t });
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
systemTrigger
.
prototype
.
update
({
status
:
TRIGGER_STATUS_SUCCESS
},
{
where
:
{
id
:
trigId
,
status
:
0
},
transaction
:
t
});
await
t
.
commit
();
await
t
.
commit
();
rtn
=
true
;
rtn
=
true
;
...
@@ -212,7 +237,6 @@ export const doCoinTypeTrigger = async function (trigId: any, coinSymbol: any, a
...
@@ -212,7 +237,6 @@ export const doCoinTypeTrigger = async function (trigId: any, coinSymbol: any, a
export
const
updateRedisPairs
=
async
function
()
{
export
const
updateRedisPairs
=
async
function
()
{
console
.
log
(
'updateRedisPairs'
);
console
.
log
(
'updateRedisPairs'
);
try
{
try
{
//TODO:没有了
//let list = await exPair.prototype.findAll({ where: { is_active: 1 } });
//let list = await exPair.prototype.findAll({ where: { is_active: 1 } });
// redisUtilsCommon.writeSync(KEY_PAIR_LIST, JSON.stringify(list));
// redisUtilsCommon.writeSync(KEY_PAIR_LIST, JSON.stringify(list));
}
}
...
...
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