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
ad32dd5b
Commit
ad32dd5b
authored
Dec 19, 2024
by
1486327116
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2b6bd534
5b87a795
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
11 deletions
+101
-11
task_system_trigger.ts
cron/task/task_system_trigger.ts
+15
-1
i18n.control.ts
src/functional/mvc/control/i18n.control.ts
+24
-0
i18n.service.ts
src/functional/mvc/service/i18n.service.ts
+60
-10
index.ts
src/functional/router/v1/index.ts
+1
-0
access-limit.ts
src/setting/access-limit.ts
+1
-0
No files found.
cron/task/task_system_trigger.ts
View file @
ad32dd5b
...
...
@@ -11,7 +11,7 @@ import * as RobotUtil from "../../src/utils/robotUtils";
/**
* 每
5
秒监控一次交易对设置变化
* 每
2
秒监控一次交易对设置变化
*/
let
jobTrigger
=
function
()
{
...
...
@@ -62,6 +62,20 @@ let jobTrigger = function () {
console
.
error
(
'jobExPairTrigger fail:'
,
e
);
}
});
/**
* 激活的交易对 每分钟触发
*/
schedule
.
scheduleJob
(
'*/1 * * * *'
,
async
function
()
{
try
{
let
nowTime
=
new
Date
();
console
.
log
(
'job update redis active pair at '
,
nowTime
);
await
triggerSvr
.
updateRedisPairs
();
}
catch
(
e
)
{
console
.
error
(
'job update redis active pair fail:'
,
e
);
}
});
}
jobTrigger
();
\ No newline at end of file
src/functional/mvc/control/i18n.control.ts
View file @
ad32dd5b
...
...
@@ -95,4 +95,28 @@ export const versionList = async (req: any, infoVO: I18nInfoVO) => {
}
};
/**
* 分页查询国际化信息检测列表(语言有为空的)
* @param req
* @param infoVO
*/
export
const
checkList
=
async
(
req
:
any
,
infoPageVO
:
I18nInfoPageVO
)
=>
{
let
func_name
=
"i18nCtrl.checkList"
;
let
cmd
=
req
.
path
;
try
{
infoPageVO
.
page
=
Optional
.
opt
(
infoPageVO
,
'page'
,
1
);
infoPageVO
.
size
=
Optional
.
opt
(
infoPageVO
,
'size'
,
20
);
if
(
!
infoPageVO
.
site
){
throw
ErrorCode
.
PARAM_MISS
;
}
let
res
=
await
i18nService
.
checkList
(
infoPageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/service/i18n.service.ts
View file @
ad32dd5b
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import
{
i18nInfo
,
i18nInfoHistory
,
ormDB
}
from
"@madex/ex-ts-dao"
;
import
{
i18nInfo
,
i18nInfoHistory
,
ormDB
,
i18nInfoPreview
}
from
"@madex/ex-ts-dao"
;
import
*
as
i18nLogService
from
"../service/i18nlog.service"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
...
...
@@ -42,7 +42,14 @@ export const list = async (infoPageVO: I18nInfoPageVO) => {
condition
[
'code'
]
=
infoPageVO
.
code
;
}
if
(
infoPageVO
.
zh_cn
)
{
condition
[
'zh_cn'
]
=
{
[
ormDB
.
Op
.
like
]:
`
${
infoPageVO
.
zh_cn
}
%`
};
condition
[
ormDB
.
Op
.
or
]
=
{
zh_cn
:
{
[
ormDB
.
Op
.
like
]:
`
${
infoPageVO
.
zh_cn
}
%`
},
en_us
:
{
[
ormDB
.
Op
.
like
]:
`
${
infoPageVO
.
zh_cn
}
%`
},
ja_jp
:
{
[
ormDB
.
Op
.
like
]:
`
${
infoPageVO
.
zh_cn
}
%`
},
ko_kr
:
{
[
ormDB
.
Op
.
like
]:
`
${
infoPageVO
.
zh_cn
}
%`
},
vi_vn
:
{
[
ormDB
.
Op
.
like
]:
`
${
infoPageVO
.
zh_cn
}
%`
},
ar_ae
:
{
[
ormDB
.
Op
.
like
]:
`
${
infoPageVO
.
zh_cn
}
%`
},
};
}
let
page
=
Number
(
infoPageVO
.
page
);
...
...
@@ -171,7 +178,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
let
infoList
=
JSON
.
parse
(
infoJson
);
let
lastVersionList
=
await
getLastVersionList
(
infoVO
.
site
);
let
timestamp
=
new
Date
()
.
getTime
()
;
let
timestamp
=
new
Date
();
let
lastVersionMap
:
any
=
{};
for
(
let
item
of
lastVersionList
)
{
...
...
@@ -179,7 +186,6 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
delete
item
[
'id'
];
delete
item
[
'version'
];
delete
item
[
'createdAt'
];
lastVersionMap
[
key
]
=
item
;
...
...
@@ -191,7 +197,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
throw
ErrorCode
.
PARAM_MISS
;
}
let
key
=
insertOne
[
'platform'
]
+
'_'
+
insertOne
[
'module'
]
+
'_'
+
insertOne
[
'code'
];
insertOne
.
site
=
infoVO
.
site
;
insertOne
.
sub_code
=
insertOne
.
sub_code
!==
null
?
insertOne
.
sub_code
:
(
lastVersionMap
[
key
]
?
lastVersionMap
[
key
].
sub_code
:
''
);
...
...
@@ -221,14 +227,21 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
for
(
let
key
of
_
.
keys
(
lastVersionMap
))
{
resList
.
push
(
lastVersionMap
[
key
]);
}
return
resList
;
await
i18nInfoPreview
.
prototype
.
bulkCreate
(
resList
,
{
updateOnDuplicate
:
[
'sub_code'
,
'zh_cn'
,
'en_us'
,
'ja_jp'
,
'ko_kr'
,
'vi_vn'
,
'ar_ae'
,
'updatedAt'
],
});
let
orderByList
=
_
.
orderBy
(
resList
,
[
'updatedAt'
],
[
'desc'
]);
return
orderByList
;
};
export
const
versionList
=
async
(
site
:
any
)
=>
{
export
const
versionList
=
async
(
site
:
any
)
=>
{
let
options
=
{
attributes
:
[
'version'
,
'createdAt'
,
'updatedAt'
],
where
:
{
site
:
Number
(
site
)
site
:
Number
(
site
)
},
order
:
[[
'version'
,
'desc'
]],
group
:
[
'version'
,
'createdAt'
,
'updatedAt'
],
...
...
@@ -246,6 +259,41 @@ export const versionList = async (site:any) => {
};
export
const
checkList
=
async
(
infoPageVO
:
I18nInfoPageVO
)
=>
{
let
condition
=
{
site
:
infoPageVO
.
site
,
[
ormDB
.
Op
.
or
]:
{
zh_cn
:
''
,
en_us
:
''
,
ja_jp
:
''
,
ko_kr
:
''
,
vi_vn
:
''
,
ar_ae
:
''
,
}
};
if
(
infoPageVO
.
platform
)
{
condition
[
'platform'
]
=
Number
(
infoPageVO
.
platform
);
}
if
(
infoPageVO
.
module
)
{
condition
[
'module'
]
=
Number
(
infoPageVO
.
module
);
}
if
(
infoPageVO
.
code
)
{
condition
[
'code'
]
=
infoPageVO
.
code
;
}
let
page
=
Number
(
infoPageVO
.
page
);
let
size
=
Number
(
infoPageVO
.
size
);
let
resList
=
await
i18nInfo
.
prototype
.
findAndCount
({
where
:
condition
,
limit
:
size
,
offset
:
(
page
-
1
)
*
size
,
order
:
[[
"id"
,
"asc"
]],
raw
:
true
});
return
resList
;
};
/**
* 查询站点版本记录
...
...
@@ -300,8 +348,8 @@ function addVersion(version: string, add: number) {
for
(
let
i
=
versionNumArr
.
length
-
1
;
i
>=
0
;
i
--
)
{
versionNumArr
[
i
]
+=
add
;
while
(
versionNumArr
[
i
]
>=
1
0
)
{
versionNumArr
[
i
]
-=
1
0
;
while
(
versionNumArr
[
i
]
>=
2
0
)
{
versionNumArr
[
i
]
-=
2
0
;
if
(
i
>
0
)
{
versionNumArr
[
i
-
1
]
++
;
}
...
...
@@ -312,3 +360,5 @@ function addVersion(version: string, add: number) {
return
versionNumArr
.
join
(
'.'
);
}
src/functional/router/v1/index.ts
View file @
ad32dd5b
...
...
@@ -65,6 +65,7 @@ const postFunc = {
'i18n/info/version/list'
:
i18nCtrl
.
versionList
,
//版本列表
'i18n/info/history/list'
:
i18nLogCtrl
.
list
,
//历史版本信息列表
'i18n/info/history/revert'
:
i18nLogCtrl
.
revert
,
//版本回退
'i18n/info/check/list'
:
i18nCtrl
.
checkList
,
//检测列表(语言有为空的)
//金融部-交易管理-交易对配置
'spotPair/save'
:
spotPairCtrl
.
save
,
//新增
'spotPair/update'
:
spotPairCtrl
.
update
,
//修改
...
...
src/setting/access-limit.ts
View file @
ad32dd5b
...
...
@@ -16,6 +16,7 @@ let cmdWhiteList = {
'i18n/info/version/list'
:
1
,
'i18n/info/history/list'
:
1
,
'i18n/info/history/revert'
:
1
,
'i18n/info/check/list'
:
1
,
//金融部-交易管理-交易对配置
'spotPair/save'
:
1
,
'spotPair/update'
:
1
,
...
...
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