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
bd3c380e
Commit
bd3c380e
authored
Nov 29, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
国际化新接口
parent
5c09dfd0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
i18nlog.control.ts
src/functional/mvc/control/i18nlog.control.ts
+3
-0
i18n.service.ts
src/functional/mvc/service/i18n.service.ts
+11
-11
i18nlog.service.ts
src/functional/mvc/service/i18nlog.service.ts
+4
-2
No files found.
src/functional/mvc/control/i18nlog.control.ts
View file @
bd3c380e
...
...
@@ -17,6 +17,9 @@ export const list = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => {
try
{
i18nInfoLogVO
.
page
=
Optional
.
opt
(
i18nInfoLogVO
,
'page'
,
1
);
i18nInfoLogVO
.
size
=
Optional
.
opt
(
i18nInfoLogVO
,
'size'
,
20
);
if
(
!
i18nInfoLogVO
.
version
){
throw
ErrorCode
.
PARAM_MISS
;
}
let
res
=
await
i18nLogService
.
list
(
i18nInfoLogVO
);
return
Res3Utils
.
result
(
res
);
}
...
...
src/functional/mvc/service/i18n.service.ts
View file @
bd3c380e
...
...
@@ -61,7 +61,7 @@ export const add = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
let
infoList
=
JSON
.
parse
(
infoJson
);
let
lastVersionList
=
await
getLastVersionList
();
let
timestamp
=
new
Date
()
.
getTime
()
;
let
timestamp
=
new
Date
();
let
insertHistoryList
:
any
=
[];
let
idList
:
any
=
[];
let
lastVersionMap
:
any
=
{};
...
...
@@ -71,7 +71,7 @@ export const add = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
lastVersionMap
[
key
]
=
item
;
idList
.
push
(
item
[
'id'
]);
item
[
'info_id'
]
=
item
[
'id'
];
item
[
'created
_at'
]
=
item
[
'updated_a
t'
];
item
[
'created
At'
]
=
item
[
'updatedA
t'
];
delete
item
[
'id'
];
insertHistoryList
.
push
(
item
);
}
...
...
@@ -107,8 +107,8 @@ export const add = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
insertOne
.
ar_ae
=
insertOne
.
ar_ae
?
insertOne
.
ar_ae
:
(
lastVersionMap
[
key
]
?
lastVersionMap
[
key
].
ar_ae
:
''
);
insertOne
.
created
_a
t
=
timestamp
;
insertOne
.
updated
_a
t
=
timestamp
;
insertOne
.
created
A
t
=
timestamp
;
insertOne
.
updated
A
t
=
timestamp
;
insertOrUpdateList
.
push
(
insertOne
);
}
...
...
@@ -126,7 +126,7 @@ export const add = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
if
(
lastVersionList
.
length
)
{
await
i18nInfo
.
prototype
.
update
({
version
:
version
,
updated
_a
t
:
timestamp
updated
A
t
:
timestamp
},
{
where
:
{
id
:
idList
...
...
@@ -137,7 +137,7 @@ export const add = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
//批量插入或更新
if
(
insertOrUpdateList
.
length
)
{
await
i18nInfo
.
prototype
.
bulkCreate
(
insertOrUpdateList
,
{
updateOnDuplicate
:
[
'sub_code'
,
'zh_cn'
,
'en_us'
,
'ja_jp'
,
'ko_kr'
,
'vi_vn'
,
'ar_ae'
,
'updated
_a
t'
],
updateOnDuplicate
:
[
'sub_code'
,
'zh_cn'
,
'en_us'
,
'ja_jp'
,
'ko_kr'
,
'vi_vn'
,
'ar_ae'
,
'updated
A
t'
],
transaction
:
tx
});
}
...
...
@@ -173,7 +173,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
delete
item
[
'id'
];
delete
item
[
'version'
];
delete
item
[
'created
_a
t'
];
delete
item
[
'created
A
t'
];
lastVersionMap
[
key
]
=
item
;
...
...
@@ -207,7 +207,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
insertOne
.
ar_ae
=
insertOne
.
ar_ae
?
insertOne
.
ar_ae
:
(
lastVersionMap
[
key
]
?
lastVersionMap
[
key
].
ar_ae
:
''
);
insertOne
.
updated
_a
t
=
timestamp
;
insertOne
.
updated
A
t
=
timestamp
;
lastVersionMap
[
key
]
=
insertOne
;
}
...
...
@@ -215,15 +215,15 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
for
(
let
key
of
_
.
keys
(
lastVersionMap
))
{
resList
.
push
(
lastVersionMap
[
key
]);
}
return
'ok'
;
return
resList
;
};
export
const
versionList
=
async
()
=>
{
let
options
=
{
attributes
:
[
'version'
,
'created
_at'
,
'updated_a
t'
],
attributes
:
[
'version'
,
'created
At'
,
'updatedA
t'
],
where
:
{},
order
:
[[
'version'
,
'desc'
]],
group
:
[
'version'
,
'created
_at'
,
'updated_a
t'
],
group
:
[
'version'
,
'created
At'
,
'updatedA
t'
],
raw
:
true
}
let
task1
=
i18nInfo
.
prototype
.
findAll
(
options
);
...
...
src/functional/mvc/service/i18nlog.service.ts
View file @
bd3c380e
...
...
@@ -16,7 +16,9 @@ export interface I18nInfoLogVO extends I18nInfoPageVO {
export
async
function
list
(
i18nInfoLogVO
:
I18nInfoLogVO
)
{
let
condition
=
{};
let
condition
=
{
version
:
i18nInfoLogVO
.
version
};
if
(
i18nInfoLogVO
.
platform
)
{
condition
[
'platform'
]
=
Number
(
i18nInfoLogVO
.
platform
);
}
...
...
@@ -68,7 +70,7 @@ export async function revert(i18nInfoLogVO: I18nInfoLogVO, currentUserId: any, i
current_version
=
item
.
version
;
let
info_id
=
item
.
id
;
item
.
info_id
=
info_id
;
item
.
created
_at
=
item
.
updated_a
t
;
item
.
created
At
=
item
.
updatedA
t
;
delete
item
.
id
;
insertHistoryList
.
push
(
item
)
}
...
...
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