Commit ad32dd5b authored by 1486327116's avatar 1486327116

Merge remote-tracking branch 'origin/master'

parents 2b6bd534 5b87a795
...@@ -11,7 +11,7 @@ import * as RobotUtil from "../../src/utils/robotUtils"; ...@@ -11,7 +11,7 @@ import * as RobotUtil from "../../src/utils/robotUtils";
/** /**
* 每5秒监控一次交易对设置变化 * 每2秒监控一次交易对设置变化
*/ */
let jobTrigger = function () { let jobTrigger = function () {
...@@ -62,6 +62,20 @@ let jobTrigger = function () { ...@@ -62,6 +62,20 @@ let jobTrigger = function () {
console.error('jobExPairTrigger fail:', e); 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(); jobTrigger();
\ No newline at end of file
...@@ -95,4 +95,28 @@ export const versionList = async (req: any, infoVO: I18nInfoVO) => { ...@@ -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);
}
};
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上 // @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 * as i18nLogService from "../service/i18nlog.service";
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { addOptLog } from "./userOptLog.service"; import { addOptLog } from "./userOptLog.service";
...@@ -42,7 +42,14 @@ export const list = async (infoPageVO: I18nInfoPageVO) => { ...@@ -42,7 +42,14 @@ export const list = async (infoPageVO: I18nInfoPageVO) => {
condition['code'] = infoPageVO.code; condition['code'] = infoPageVO.code;
} }
if (infoPageVO.zh_cn) { 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); let page = Number(infoPageVO.page);
...@@ -171,7 +178,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) = ...@@ -171,7 +178,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
let infoList = JSON.parse(infoJson); let infoList = JSON.parse(infoJson);
let lastVersionList = await getLastVersionList(infoVO.site); let lastVersionList = await getLastVersionList(infoVO.site);
let timestamp = new Date().getTime(); let timestamp = new Date();
let lastVersionMap: any = {}; let lastVersionMap: any = {};
for (let item of lastVersionList) { for (let item of lastVersionList) {
...@@ -179,7 +186,6 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) = ...@@ -179,7 +186,6 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
delete item['id']; delete item['id'];
delete item['version']; delete item['version'];
delete item['createdAt'];
lastVersionMap[key] = item; lastVersionMap[key] = item;
...@@ -191,7 +197,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) = ...@@ -191,7 +197,7 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
throw ErrorCode.PARAM_MISS; throw ErrorCode.PARAM_MISS;
} }
let key = insertOne['platform'] + '_' + insertOne['module'] + '_' + insertOne['code']; let key = insertOne['platform'] + '_' + insertOne['module'] + '_' + insertOne['code'];
insertOne.site = infoVO.site;
insertOne.sub_code = insertOne.sub_code !== null ? insertOne.sub_code : insertOne.sub_code = insertOne.sub_code !== null ? insertOne.sub_code :
(lastVersionMap[key] ? lastVersionMap[key].sub_code : ''); (lastVersionMap[key] ? lastVersionMap[key].sub_code : '');
...@@ -221,14 +227,21 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) = ...@@ -221,14 +227,21 @@ export const preview = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) =
for (let key of _.keys(lastVersionMap)) { for (let key of _.keys(lastVersionMap)) {
resList.push(lastVersionMap[key]); 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 = { let options = {
attributes: ['version', 'createdAt', 'updatedAt'], attributes: ['version', 'createdAt', 'updatedAt'],
where: { where: {
site:Number(site) site: Number(site)
}, },
order: [['version', 'desc']], order: [['version', 'desc']],
group: ['version', 'createdAt', 'updatedAt'], group: ['version', 'createdAt', 'updatedAt'],
...@@ -246,6 +259,41 @@ export const versionList = async (site:any) => { ...@@ -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) { ...@@ -300,8 +348,8 @@ function addVersion(version: string, add: number) {
for (let i = versionNumArr.length - 1; i >= 0; i--) { for (let i = versionNumArr.length - 1; i >= 0; i--) {
versionNumArr[i] += add; versionNumArr[i] += add;
while (versionNumArr[i] >= 10) { while (versionNumArr[i] >= 20) {
versionNumArr[i] -= 10; versionNumArr[i] -= 20;
if (i > 0) { if (i > 0) {
versionNumArr[i - 1]++; versionNumArr[i - 1]++;
} }
...@@ -312,3 +360,5 @@ function addVersion(version: string, add: number) { ...@@ -312,3 +360,5 @@ function addVersion(version: string, add: number) {
return versionNumArr.join('.'); return versionNumArr.join('.');
} }
...@@ -65,6 +65,7 @@ const postFunc = { ...@@ -65,6 +65,7 @@ const postFunc = {
'i18n/info/version/list': i18nCtrl.versionList,//版本列表 'i18n/info/version/list': i18nCtrl.versionList,//版本列表
'i18n/info/history/list': i18nLogCtrl.list,//历史版本信息列表 'i18n/info/history/list': i18nLogCtrl.list,//历史版本信息列表
'i18n/info/history/revert': i18nLogCtrl.revert,//版本回退 'i18n/info/history/revert': i18nLogCtrl.revert,//版本回退
'i18n/info/check/list': i18nCtrl.checkList,//检测列表(语言有为空的)
//金融部-交易管理-交易对配置 //金融部-交易管理-交易对配置
'spotPair/save': spotPairCtrl.save,//新增 'spotPair/save': spotPairCtrl.save,//新增
'spotPair/update': spotPairCtrl.update,//修改 'spotPair/update': spotPairCtrl.update,//修改
......
...@@ -16,6 +16,7 @@ let cmdWhiteList = { ...@@ -16,6 +16,7 @@ let cmdWhiteList = {
'i18n/info/version/list': 1, 'i18n/info/version/list': 1,
'i18n/info/history/list': 1, 'i18n/info/history/list': 1,
'i18n/info/history/revert': 1, 'i18n/info/history/revert': 1,
'i18n/info/check/list': 1,
//金融部-交易管理-交易对配置 //金融部-交易管理-交易对配置
'spotPair/save': 1, 'spotPair/save': 1,
'spotPair/update': 1, 'spotPair/update': 1,
......
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