Commit bd3c380e authored by ml's avatar ml

国际化新接口

parent 5c09dfd0
......@@ -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);
}
......
......@@ -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_at'];
item['createdAt'] = item['updatedAt'];
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_at = timestamp;
insertOne.updated_at = timestamp;
insertOne.createdAt = timestamp;
insertOne.updatedAt = 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_at: timestamp
updatedAt: 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_at'],
updateOnDuplicate: ['sub_code', 'zh_cn', 'en_us', 'ja_jp', 'ko_kr', 'vi_vn', 'ar_ae', 'updatedAt'],
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_at'];
delete item['createdAt'];
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_at = timestamp;
insertOne.updatedAt = 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_at'],
attributes: ['version', 'createdAt', 'updatedAt'],
where: {},
order: [['version', 'desc']],
group: ['version', 'created_at', 'updated_at'],
group: ['version', 'createdAt', 'updatedAt'],
raw: true
}
let task1 = i18nInfo.prototype.findAll(options);
......
......@@ -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_at;
item.createdAt = item.updatedAt;
delete item.id;
insertHistoryList.push(item)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment