Commit 50e8f611 authored by ml's avatar ml

逻辑调整、新增接口

parent 67bfdb79
This diff is collapsed.
...@@ -55,4 +55,6 @@ export const ErrorCode = { ...@@ -55,4 +55,6 @@ export const ErrorCode = {
IP_ADDR_LIMIT:'30051',//ip地址受限或不在您配置的IP白名单中 IP_ADDR_LIMIT:'30051',//ip地址受限或不在您配置的IP白名单中
DEPARTMENT_HAS_USER:'30052',//当前部门下有用户存在,不允许修改或删除 DEPARTMENT_HAS_USER:'30052',//当前部门下有用户存在,不允许修改或删除
PWD_ILLEGAL:'30053',//密码过短或过长 PWD_ILLEGAL:'30053',//密码过短或过长
FIXED_AND_DEFAULT:'30054',//固定和默认不能同时为是
NOT_HIDDEN_TWO:'30055',//每种语言非隐藏并且固定的至少要有2个
} }
...@@ -15,4 +15,21 @@ export const RedisVal = { ...@@ -15,4 +15,21 @@ export const RedisVal = {
/** /**
* App审核管理 * App审核管理
*/ */
export const APP_VERSION_KEY = "app:apply:version:"; // 防止之后会有android export const APP_VERSION_KEY = "app:apply:version:"; // 防止之后会有android
\ No newline at end of file
/**
* app动态域名配置在缓存中的KEY前缀。
*/
export const ADDRESS_INFO_REDIS_KEY = "b029.addressInfo.service.get";
/**
* app动态域名对象配置在缓存中的KEY前缀。
*/
export const ADDRESS_INFO_REDIS_KEY_OBJ = "b029.addressInfo.service.get.obj";
/**
* App特定机型配置
*/
export const APP_SPECIAL_MODEL_REDIS_KEY = "b029.app.sepecial.model.redis.key";
...@@ -21,7 +21,7 @@ export const list = async (req: any, pageVO: AppVersionPageVO) => { ...@@ -21,7 +21,7 @@ export const list = async (req: any, pageVO: AppVersionPageVO) => {
let key = APP_VERSION_KEY + 'ios'; let key = APP_VERSION_KEY + 'ios';
let data = await RedisClient.getSync(key); let data = await RedisClient.getSync(key);
let res = { let res = {
ios: data ios: data ? data :""
} }
return Res3Utils.result(res); return Res3Utils.result(res);
} }
......
import { AppVersionPageVO } from "../service/appVersion.service";
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert, datetimeUtils } = require('@madex/ex-js-public');
import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
import { ADDRESS_INFO_REDIS_KEY, ADDRESS_INFO_REDIS_KEY_OBJ, APP_VERSION_KEY } from "../../../constant/redis-val";
import { addOptLog } from "../service/userOptLog.service";
let { authCommon: AuthCommon, redisUtilsCommon: RedisClient, } = require('@madex/ex-js-common');
let isIp = require('is-ip');
interface ParamVO {
host?: string,
isObj?: number
}
/**
* app动态域名获取详情
* @param req
* @param infoVO
*/
export const get = async (req: any, paramVO: ParamVO) => {
let func_name = "appDynamicDomain.control.get";
try {
let isObj = Number(paramVO.isObj);
let data = isObj == 1 ? await RedisClient.getSync(ADDRESS_INFO_REDIS_KEY_OBJ) : await RedisClient.getSync(ADDRESS_INFO_REDIS_KEY);
return Res3Utils.result(data);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* app动态域名设置详情
* @param req
* @param authConfigVO
*/
export const update = async (req: any, paramVO: ParamVO) => {
let func_name = "appDynamicDomain.control.update";
try {
let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let host = String(paramVO.host);
let isObj = Number(paramVO.isObj);
if (!host) {
throw ErrorCode.PARAM_MISS
}
if (isObj == 1) {
let hostObj = JSON.parse(host);
let hostArr = hostObj.hosts;
if (!hostArr.length) {
throw ErrorCode.PARAM_MISS
}
let hostString = hostArr[0];
let sharesArr = hostObj.shares;
if (!sharesArr.length) {
throw ErrorCode.PARAM_MISS
}
let shareString = sharesArr[0];
let apiHostArr = hostObj.apiHosts;
if (!apiHostArr.length) {
throw ErrorCode.PARAM_MISS
}
let oldPush = hostObj.oldPush;
let newPush = hostObj.newPush;
let data = {
host: hostString,
hosts: hostArr,
share: shareString,
shares: sharesArr,
oldPush: oldPush,
newPush: newPush,
apiHosts: apiHostArr
}
await RedisClient.writeSync(ADDRESS_INFO_REDIS_KEY, hostString);
await RedisClient.writeSync(ADDRESS_INFO_REDIS_KEY_OBJ, JSON.stringify(data));
}
else {
await RedisClient.writeSync(ADDRESS_INFO_REDIS_KEY, host);
}
//管理后台操作日志
addOptLog(currentUserId, 0, 'App动态域名设置', ip, `Host:${host}`, 'App动态域名');
return Res3Utils.result('ok');
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
import * as appFeatureService from "../service/appFeature.service";
import { AppFeatureVO, AppFeaturePageVO } from "../service/appFeature.service";
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert, datetimeUtils } = require('@madex/ex-js-public');
import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
import { DEVICE_ARR, PLATFORM_ARR, STATUS_ARR } from "../../../constant/appVersionConstant";
import { appFeatureManage, arbitrageOrmDB } from "@madex/ex-ts-dao";
let isIp = require('is-ip');
/**
* app首页入口列表
* @param req
* @param infoVO
*/
export const list = async (req: any, pageVO: AppFeaturePageVO) => {
let func_name = "appFeature.control.list";
try {
pageVO.page = Optional.opt(pageVO, 'page', 1);
pageVO.size = Optional.opt(pageVO, 'size', 20);
let res = await appFeatureService.list(pageVO);
return Res3Utils.result(res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* 添加新的App首页入口
* @param req
* @param authConfigVO
*/
export const add = async (req: any, appFeatureVO: AppFeatureVO) => {
let func_name = "appFeature.control.add";
try {
let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
if (appFeatureVO.is_fixed == 1 && appFeatureVO.is_default == 1) {
throw ErrorCode.FIXED_AND_DEFAULT
}
let res = await appFeatureService.add(appFeatureVO, currentUserId, ip);
return Res3Utils.result(res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* 修改app入口信息
* @param req
* @param authConfigVO
*/
export const update = async (req: any, appFeatureVO: AppFeatureVO) => {
let func_name = "appFeature.control.update";
try {
let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
if (!appFeatureVO.id) {
throw ErrorCode.PARAM_MISS
}
if (appFeatureVO.is_fixed == 1 && appFeatureVO.is_default == 1) {
throw ErrorCode.FIXED_AND_DEFAULT
}
if (appFeatureVO.is_fixed == 0) {
await checkIsFixedCount(appFeatureVO.id);
}
let res = await appFeatureService.update(appFeatureVO, currentUserId, ip);
return Res3Utils.result(res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* 删除app入口信息
* @param req
* @param authConfigVO
*/
export const del = async (req: any, appFeatureVO: AppFeatureVO) => {
let func_name = "appFeature.control.del";
try {
let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
if (!appFeatureVO.id) {
throw ErrorCode.PARAM_MISS
}
let res = await appFeatureService.del(appFeatureVO.id, currentUserId, ip);
return Res3Utils.result(res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* 校验固定数量
* @param id
*/
async function checkIsFixedCount(id: number) {
let dbInfoList = await appFeatureManage.prototype.findAll({
where: {
is_fixed: 1,
is_hidden: 0,
id: { [arbitrageOrmDB.Op.ne]: id }
},
raw: true
});
let map: any = {};
for (let item of dbInfoList) {
let featureArrStr = item.feature;
let featureArr = JSON.parse(featureArrStr);
for (let one of featureArr) {
let lang = one.lang;
if (!map[lang]) {
map[lang] = 1;
}
else {
let count = map[lang];
map[lang] = count + 1;
}
}
}
let keys = map.keys;
for (let key of keys) {
if (map[key] < 2) {
throw ErrorCode.NOT_HIDDEN_TWO
}
}
}
import { AppVersionPageVO } from "../service/appVersion.service";
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert, datetimeUtils } = require('@madex/ex-js-public');
import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
import { ADDRESS_INFO_REDIS_KEY, ADDRESS_INFO_REDIS_KEY_OBJ, APP_SPECIAL_MODEL_REDIS_KEY, APP_VERSION_KEY } from "../../../constant/redis-val";
import { addOptLog } from "../service/userOptLog.service";
let { authCommon: AuthCommon, redisUtilsCommon: RedisClient, } = require('@madex/ex-js-common');
let isIp = require('is-ip');
interface ParamVO {
modelName?: string,//型号
systemVersion?: string,//系统版本
op?: number//操作(1插入 2 删除)
}
/**
* app特别机型配置获取详情
* @param req
* @param infoVO
*/
export const get = async (req: any, paramVO: ParamVO) => {
let func_name = "appSpecialModel.control.get";
try {
let cacheData = await RedisClient.getSync(APP_SPECIAL_MODEL_REDIS_KEY);
let dataList: string[] = []
if (cacheData) {
dataList = cacheData.split(",");
}
let resList: any[] = [];
for (let item of dataList) {
let tempArr = item.split("::");
let one = {
modelName: tempArr[0],
systemVersion: tempArr[1],
}
resList.push(one);
}
return Res3Utils.result(resList);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* app特别机型配置
* @param req
* @param authConfigVO
*/
export const update = async (req: any, paramVO: ParamVO) => {
let func_name = "appSpecialModel.control.update";
try {
let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let modelName = String(paramVO.modelName);
let systemVersion = String(paramVO.systemVersion);
let op = Number(paramVO.op);
if (!modelName || !systemVersion || ![1, 2].includes(op)) {
throw ErrorCode.PARAM_MISS;
}
let cacheData = await RedisClient.getSync(APP_SPECIAL_MODEL_REDIS_KEY);
let dataList: string[] = [];
if (cacheData){
let cdList = cacheData.split(",");
for (let item of cdList) {
dataList.push(item)
}
}
let modelNameKey = modelName.concat("::").concat(systemVersion);
if (op == 1) {//插入
let flag: boolean = false;
for (let item of dataList) {
if (item == modelNameKey) {
flag = true
}
}
if (!flag) {
dataList.push(modelNameKey);
}
else {
throw ErrorCode.DATA_EXIST
}
}
else {//删除
dataList = dataList.filter(item => item != modelNameKey);
}
let dataStr = dataList.join(",");
await RedisClient.writeSync(APP_SPECIAL_MODEL_REDIS_KEY, dataStr);
//管理后台操作日志
addOptLog(currentUserId, 0, 'App特别机型配置', ip, `data:${dataStr}`, 'App特别机型配置');
return Res3Utils.result('ok');
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
...@@ -3,6 +3,8 @@ import { HotPairConfigVO, HotPairConfigPageVO } from "../service/hotPairConfig.s ...@@ -3,6 +3,8 @@ import { HotPairConfigVO, HotPairConfigPageVO } from "../service/hotPairConfig.s
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public'); let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public');
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
let isIp = require('is-ip');
/** /**
* 分页查询热门交易对配置列表 * 分页查询热门交易对配置列表
...@@ -33,7 +35,9 @@ export const add = async (req: any, hotPairConfigVO: HotPairConfigVO) => { ...@@ -33,7 +35,9 @@ export const add = async (req: any, hotPairConfigVO: HotPairConfigVO) => {
try { try {
ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.pair); ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.pair);
ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.weight); ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.weight);
let res = await hotPairConfigService.add(hotPairConfigVO); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await hotPairConfigService.add(hotPairConfigVO,currentUserId,ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
...@@ -53,7 +57,9 @@ export const update = async (req: any, hotPairConfigVO: HotPairConfigVO) => { ...@@ -53,7 +57,9 @@ export const update = async (req: any, hotPairConfigVO: HotPairConfigVO) => {
ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.id); ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.id);
ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.pair); ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.pair);
ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.weight); ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.weight);
let res = await hotPairConfigService.update(hotPairConfigVO); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await hotPairConfigService.update(hotPairConfigVO,currentUserId,ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
...@@ -70,7 +76,9 @@ export const del = async (req: any, hotPairConfigVO: HotPairConfigVO) => { ...@@ -70,7 +76,9 @@ export const del = async (req: any, hotPairConfigVO: HotPairConfigVO) => {
let func_name = "hotPairConfigCtrl.del"; let func_name = "hotPairConfigCtrl.del";
try { try {
ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.id); ApiAssert.notNull(ErrorCode.PARAM_MISS, hotPairConfigVO.id);
let res = await hotPairConfigService.del(Number(hotPairConfigVO.id)); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await hotPairConfigService.del(Number(hotPairConfigVO.id),currentUserId,ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
......
import * as i18nService from "../service/i18n.service"; import * as i18nService from "../service/i18n.service";
import { I18nInfoVO, I18nInfoPageVO } from "../service/i18n.service"; import { I18nInfoVO, I18nInfoPageVO } from "../service/i18n.service";
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
let isIp = require('is-ip');
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public'); let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public');
...@@ -15,9 +17,6 @@ export const list = async (req: any, infoPageVO: I18nInfoPageVO) => { ...@@ -15,9 +17,6 @@ export const list = async (req: any, infoPageVO: I18nInfoPageVO) => {
try { try {
infoPageVO.page = Optional.opt(infoPageVO, 'page', 1); infoPageVO.page = Optional.opt(infoPageVO, 'page', 1);
infoPageVO.size = Optional.opt(infoPageVO, 'size', 20); infoPageVO.size = Optional.opt(infoPageVO, 'size', 20);
infoPageVO.platform = Optional.opt(infoPageVO, 'platform', 1);
infoPageVO.module = Optional.opt(infoPageVO, 'module', 1);
infoPageVO.lang = Optional.opt(infoPageVO, 'lang', 'en');
let res = await i18nService.list(infoPageVO); let res = await i18nService.list(infoPageVO);
return Res3Utils.result(res); return Res3Utils.result(res);
...@@ -37,7 +36,9 @@ export const add = async (req: any, infoVO: I18nInfoVO) => { ...@@ -37,7 +36,9 @@ export const add = async (req: any, infoVO: I18nInfoVO) => {
let cmd = req.path; let cmd = req.path;
try { try {
await preCheck(infoVO); await preCheck(infoVO);
let res = await i18nService.add(infoVO); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await i18nService.add(infoVO,currentUserId,ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
...@@ -55,7 +56,9 @@ export const update = async (req: any, infoVO: I18nInfoVO) => { ...@@ -55,7 +56,9 @@ export const update = async (req: any, infoVO: I18nInfoVO) => {
let cmd = req.path; let cmd = req.path;
try { try {
ApiAssert.notNull(ErrorCode.PARAM_MISS, infoVO.id); ApiAssert.notNull(ErrorCode.PARAM_MISS, infoVO.id);
let res = await i18nService.update(infoVO); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await i18nService.update(infoVO,currentUserId,ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
...@@ -73,7 +76,9 @@ export const del = async (req: any, infoVO: I18nInfoVO) => { ...@@ -73,7 +76,9 @@ export const del = async (req: any, infoVO: I18nInfoVO) => {
let cmd = req.path; let cmd = req.path;
try { try {
ApiAssert.notNull(ErrorCode.PARAM_MISS, infoVO.id); ApiAssert.notNull(ErrorCode.PARAM_MISS, infoVO.id);
let res = await i18nService.del(infoVO); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await i18nService.del(infoVO,currentUserId,ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
......
import * as i18nLogService from "../service/i18nlog.service"; import * as i18nLogService from "../service/i18nlog.service";
import { I18nInfoLogVO } from "../service/i18nlog.service"; import { I18nInfoLogVO } from "../service/i18nlog.service";
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public'); let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public');
let isIp = require('is-ip');
/** /**
* 国际化信息修改日志列表 * 国际化信息修改日志列表
...@@ -15,9 +17,6 @@ export const list = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => { ...@@ -15,9 +17,6 @@ export const list = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => {
try { try {
i18nInfoLogVO.page = Optional.opt(i18nInfoLogVO, 'page', 1); i18nInfoLogVO.page = Optional.opt(i18nInfoLogVO, 'page', 1);
i18nInfoLogVO.size = Optional.opt(i18nInfoLogVO, 'size', 20); i18nInfoLogVO.size = Optional.opt(i18nInfoLogVO, 'size', 20);
i18nInfoLogVO.platform = Optional.opt(i18nInfoLogVO, 'platform', 1);
i18nInfoLogVO.module = Optional.opt(i18nInfoLogVO, 'module', 1);
i18nInfoLogVO.lang = Optional.opt(i18nInfoLogVO, 'lang', 'en');
let res = await i18nLogService.list(i18nInfoLogVO); let res = await i18nLogService.list(i18nInfoLogVO);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
...@@ -35,9 +34,11 @@ export const revert = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => { ...@@ -35,9 +34,11 @@ export const revert = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => {
let func_name = "i18nLogCtrl.revert"; let func_name = "i18nLogCtrl.revert";
let cmd = req.path; let cmd = req.path;
try { try {
let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
ApiAssert.notNull(ErrorCode.PARAM_MISS, i18nInfoLogVO.id); ApiAssert.notNull(ErrorCode.PARAM_MISS, i18nInfoLogVO.id);
ApiAssert.notNull(ErrorCode.PARAM_MISS, i18nInfoLogVO.info_id); ApiAssert.notNull(ErrorCode.PARAM_MISS, i18nInfoLogVO.info_id);
let res = await i18nLogService.revert(i18nInfoLogVO); let res = await i18nLogService.revert(i18nInfoLogVO,currentUserId,ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
......
...@@ -3,6 +3,9 @@ import { NoticeVO, NoticePageVO } from "../service/notice.service"; ...@@ -3,6 +3,9 @@ import { NoticeVO, NoticePageVO } from "../service/notice.service";
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public'); let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public');
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { getCurrentUserId } from "../../../utils/aclUserUtils";
let isIp = require('is-ip');
/** /**
* 消息列表 * 消息列表
...@@ -35,7 +38,9 @@ export const add = async (req: any, noticeVO: NoticeVO) => { ...@@ -35,7 +38,9 @@ export const add = async (req: any, noticeVO: NoticeVO) => {
ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.content); ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.content);
ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.notice_type); ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.notice_type);
ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.push_time); ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.push_time);
let res = await noticeService.add(noticeVO); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await noticeService.add(noticeVO, currentUserId, ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
...@@ -55,7 +60,9 @@ export const update = async (req: any, noticeVO: NoticeVO) => { ...@@ -55,7 +60,9 @@ export const update = async (req: any, noticeVO: NoticeVO) => {
let func_name = "noticeCtrl.update"; let func_name = "noticeCtrl.update";
try { try {
ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.id); ApiAssert.notNull(ErrorCode.PARAM_MISS, noticeVO.id);
let res = await noticeService.update(noticeVO); let ip = isIp(req.ip) ? req.ip : '*.*.*.*';
let currentUserId = await getCurrentUserId(req.cookies.session_id);
let res = await noticeService.update(noticeVO, currentUserId, ip);
return Res3Utils.result(res); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
......
import { ormDB, appVersion, arbitrageOrmDB, appFeatureManage, } from "@madex/ex-ts-dao";
import { ErrorCode } from "../../../constant/errorCode";
import { addOptLog } from "./userOptLog.service";
let _ = require('lodash');
let { logger } = require('@madex/ex-js-public');
export interface AppFeatureVO {
id?: number;
feature?: string | any;
feature_type?: number;
icon_url?: string;
tag?: string;
display_device?: string;//0:全部安卓和ios; 1: 安卓; 2: ios; 3: web; -1: 全部;
link_type?: number,
link_ios?: string;
link_android?: string;
link_web?: string;
weight?: number;
is_hidden?: number;
is_fixed?: number;
is_default?: number;
version?: string;
createdAt?: Date | any,
updatedAt?: Date | any,
}
export interface AppFeaturePageVO extends AppFeatureVO {
page?: number,
size?: number,
}
export async function list(pageVO: AppFeaturePageVO) {
let where = {};
if (pageVO.display_device || pageVO.display_device === "0") {
where['display_device'] = pageVO.display_device
}
if (pageVO.feature) {
where['feature'] = { [arbitrageOrmDB.Op.like]: `%${pageVO.feature}%` }
}
if (pageVO.is_hidden) {
where['is_hidden'] = pageVO.is_hidden
}
if (pageVO.link_type) {
where['link_type'] = pageVO.link_type
}
if (pageVO.is_default) {
where['is_default'] = pageVO.is_default
}
let resList = await appFeatureManage.prototype.findAndCount({
where: where,
limit: pageVO.size,
offset: (Number(pageVO.page) - 1) * Number(pageVO.size),
order: [["updatedAt", "desc"]],
raw: true
});
return resList;
}
export async function add(appFeatureVO: AppFeatureVO, currentUserId: any, ip: string | undefined) {
appFeatureVO.createdAt = new Date();
appFeatureVO.updatedAt = new Date();
await appFeatureManage.prototype.create(appFeatureVO);
//管理后台操作日志
addOptLog(currentUserId, 0, '新增App首页入口', ip, JSON.stringify(appFeatureVO), 'App首页入口管理');
return 'success';
}
export async function update(appFeatureVO: AppFeatureVO, currentUserId: any, ip: string | undefined) {
let exist = await appFeatureManage.prototype.findOne({
where: {
id: appFeatureVO.id
},
raw: true
});
if (!exist) {
throw ErrorCode.DATA_NOT_EXIST
}
appFeatureVO.updatedAt = new Date();
await appFeatureManage.prototype.update(appFeatureVO, {
where: {
id: Number(appFeatureVO.id)
}
})
//管理后台操作日志
addOptLog(currentUserId, 0, '修改App入口信息', ip, JSON.stringify(appFeatureVO), 'App首页入口管理');
return 'success';
}
export async function del(id: number, currentUserId: any, ip: string | undefined) {
let exist = await appFeatureManage.prototype.findOne({
where: {
id: id
},
raw: true
});
if (!exist) {
throw ErrorCode.DATA_NOT_EXIST
}
await appFeatureManage.prototype.destroy({
where: {
id: id
}
})
//管理后台操作日志
addOptLog(currentUserId, 0, '删除App入口信息', ip, `id:${id}`, 'App首页入口管理');
return 'success';
}
...@@ -90,6 +90,7 @@ export async function add(appVersionVO: AppVersionVO, currentUserId: any, ip: st ...@@ -90,6 +90,7 @@ export async function add(appVersionVO: AppVersionVO, currentUserId: any, ip: st
//管理后台操作日志 //管理后台操作日志
addOptLog(currentUserId, 0, '新增App版本', ip, JSON.stringify(appVersionVO), 'App版本管理'); addOptLog(currentUserId, 0, '新增App版本', ip, JSON.stringify(appVersionVO), 'App版本管理');
return 'success';
} }
...@@ -126,6 +127,7 @@ export async function update(appVersionVO: AppVersionVO, currentUserId: any, ip: ...@@ -126,6 +127,7 @@ export async function update(appVersionVO: AppVersionVO, currentUserId: any, ip:
//管理后台操作日志 //管理后台操作日志
addOptLog(currentUserId, 0, '修改App版本', ip, JSON.stringify(appVersionVO), 'App版本管理'); addOptLog(currentUserId, 0, '修改App版本', ip, JSON.stringify(appVersionVO), 'App版本管理');
return 'success';
} }
......
import { ormDB, hotPairConfig } from "@madex/ex-ts-dao"; import { ormDB, hotPairConfig } from "@madex/ex-ts-dao";
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { addOptLog } from "./userOptLog.service";
...@@ -43,7 +44,7 @@ export async function list(pair: any, page: number, size: number) { ...@@ -43,7 +44,7 @@ export async function list(pair: any, page: number, size: number) {
return resList; return resList;
} }
export async function add(hotPairConfigVO: HotPairConfigVO) { export async function add(hotPairConfigVO: HotPairConfigVO, currentUserId: any, ip: any) {
let dbInfo = await hotPairConfig.prototype.findOne({ let dbInfo = await hotPairConfig.prototype.findOne({
where: { where: {
...@@ -59,11 +60,13 @@ export async function add(hotPairConfigVO: HotPairConfigVO) { ...@@ -59,11 +60,13 @@ export async function add(hotPairConfigVO: HotPairConfigVO) {
hotPairConfigVO.updatedAt = new Date(); hotPairConfigVO.updatedAt = new Date();
await hotPairConfig.prototype.create(hotPairConfigVO); await hotPairConfig.prototype.create(hotPairConfigVO);
//管理后台操作日志
addOptLog(currentUserId, 0, '新增热门搜索交易对配置', ip, JSON.stringify(hotPairConfigVO), '热门搜索交易对配置');
return 'success' return 'success'
} }
export async function update(hotPairConfigVO: HotPairConfigVO) { export async function update(hotPairConfigVO: HotPairConfigVO, currentUserId: any, ip: any) {
let dbInfo = await hotPairConfig.prototype.findOne({ let dbInfo = await hotPairConfig.prototype.findOne({
where: { where: {
...@@ -86,11 +89,13 @@ export async function update(hotPairConfigVO: HotPairConfigVO) { ...@@ -86,11 +89,13 @@ export async function update(hotPairConfigVO: HotPairConfigVO) {
id: Number(hotPairConfigVO.id) id: Number(hotPairConfigVO.id)
} }
}); });
//管理后台操作日志
addOptLog(currentUserId, 0, '修改热门搜索交易对配置', ip, JSON.stringify(hotPairConfigVO), '热门搜索交易对配置');
return 'success' return 'success'
} }
export async function del(id: number) { export async function del(id: number, currentUserId: any, ip: any) {
let dbInfo = await hotPairConfig.prototype.findOne({ let dbInfo = await hotPairConfig.prototype.findOne({
where: { where: {
...@@ -108,6 +113,8 @@ export async function del(id: number) { ...@@ -108,6 +113,8 @@ export async function del(id: number) {
id: Number(id) id: Number(id)
} }
}); });
//管理后台操作日志
addOptLog(currentUserId, 0, '删除热门搜索交易对配置', ip,`id:${id}`, '热门搜索交易对配置');
return 'success' return 'success'
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import { i18nInfo, i18nInfoLog, ormDB } from "@madex/ex-ts-dao"; import { i18nInfo, i18nInfoLog, ormDB } 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";
let { logger } = require('@madex/ex-js-public'); let { logger } = require('@madex/ex-js-public');
...@@ -62,7 +63,7 @@ export const list = async (infoPageVO: I18nInfoPageVO) => { ...@@ -62,7 +63,7 @@ export const list = async (infoPageVO: I18nInfoPageVO) => {
}); });
return resList; return resList;
}; };
export const add = async (infoVO: I18nInfoVO) => { export const add = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
if (!infoVO.createdAt) { if (!infoVO.createdAt) {
infoVO.createdAt = new Date(); infoVO.createdAt = new Date();
} }
...@@ -82,10 +83,13 @@ export const add = async (infoVO: I18nInfoVO) => { ...@@ -82,10 +83,13 @@ export const add = async (infoVO: I18nInfoVO) => {
throw ErrorCode.DATA_EXIST; throw ErrorCode.DATA_EXIST;
} }
await i18nInfo.prototype.create(infoVO); await i18nInfo.prototype.create(infoVO);
//管理后台操作日志
addOptLog(currentUserId, 0, '新增国际化信息', ip, JSON.stringify(infoVO), '国际化管理');
return 'ok'; return 'ok';
}; };
export const update = async (infoVO: I18nInfoVO) => { export const update = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
let transaction: any; let transaction: any;
try { try {
let dbOneI18nInfo = await i18nInfo.prototype.findOne({ let dbOneI18nInfo = await i18nInfo.prototype.findOne({
...@@ -97,6 +101,7 @@ export const update = async (infoVO: I18nInfoVO) => { ...@@ -97,6 +101,7 @@ export const update = async (infoVO: I18nInfoVO) => {
if (!dbOneI18nInfo) { if (!dbOneI18nInfo) {
throw ErrorCode.DATA_NOT_EXIST; throw ErrorCode.DATA_NOT_EXIST;
} }
delete infoVO.id; delete infoVO.id;
let i18nInfoLogOne = await buildOneI18nInfoLog(dbOneI18nInfo, infoVO); let i18nInfoLogOne = await buildOneI18nInfoLog(dbOneI18nInfo, infoVO);
...@@ -112,6 +117,9 @@ export const update = async (infoVO: I18nInfoVO) => { ...@@ -112,6 +117,9 @@ export const update = async (infoVO: I18nInfoVO) => {
//日志 //日志
await i18nLogService.add(i18nInfoLogOne, transaction); await i18nLogService.add(i18nInfoLogOne, transaction);
await transaction.commit(); await transaction.commit();
//管理后台操作日志
addOptLog(currentUserId, 0, '修改国际化信息', ip, JSON.stringify(infoVO), '国际化管理');
return 'ok'; return 'ok';
} }
catch (e) { catch (e) {
...@@ -123,7 +131,7 @@ export const update = async (infoVO: I18nInfoVO) => { ...@@ -123,7 +131,7 @@ export const update = async (infoVO: I18nInfoVO) => {
} }
}; };
export const del = async (infoVO: I18nInfoVO) => { export const del = async (infoVO: I18nInfoVO, currentUserId: any, ip: any) => {
let transaction: any; let transaction: any;
try { try {
let dbOneI18nInfo = await i18nInfo.prototype.findOne({ let dbOneI18nInfo = await i18nInfo.prototype.findOne({
...@@ -151,6 +159,8 @@ export const del = async (infoVO: I18nInfoVO) => { ...@@ -151,6 +159,8 @@ export const del = async (infoVO: I18nInfoVO) => {
//日志 //日志
await i18nLogService.add(i18nInfoLogOne, transaction); await i18nLogService.add(i18nInfoLogOne, transaction);
await transaction.commit(); await transaction.commit();
//管理后台操作日志
addOptLog(currentUserId, 0, '删除国际化信息', ip, JSON.stringify(infoVO), '国际化管理');
return 'ok'; return 'ok';
} }
catch (e) { catch (e) {
......
...@@ -51,7 +51,7 @@ export const add = async (infoLogVO: any, tx: any) => { ...@@ -51,7 +51,7 @@ export const add = async (infoLogVO: any, tx: any) => {
}); });
}; };
export async function revert(i18nInfoLogVO: I18nInfoLogVO) { export async function revert(i18nInfoLogVO: I18nInfoLogVO, currentUserId: any, ip: any) {
let dbOneI18nInfoLog = await i18nInfoLog.prototype.findOne({ let dbOneI18nInfoLog = await i18nInfoLog.prototype.findOne({
raw: true, raw: true,
where: { where: {
...@@ -81,8 +81,7 @@ export async function revert(i18nInfoLogVO: I18nInfoLogVO) { ...@@ -81,8 +81,7 @@ export async function revert(i18nInfoLogVO: I18nInfoLogVO) {
updatedAt: dbOneI18nInfoLog.updatedAt, updatedAt: dbOneI18nInfoLog.updatedAt,
} }
if (!dbOneI18nInfo) { if (!dbOneI18nInfo) {
await i18nService.add(itemInfo); await i18nService.add(itemInfo, currentUserId, ip);
return 'ok';
} }
else { else {
delete itemInfo.createdAt; delete itemInfo.createdAt;
...@@ -91,7 +90,12 @@ export async function revert(i18nInfoLogVO: I18nInfoLogVO) { ...@@ -91,7 +90,12 @@ export async function revert(i18nInfoLogVO: I18nInfoLogVO) {
id: infoId id: infoId
} }
}); });
return 'ok';
} }
await i18nInfoLog.prototype.destroy({
where: {
id: Number(i18nInfoLogVO.id)
}
});
return 'ok';
} }
\ No newline at end of file
import { ormDB, noticeModel, noticeRead } from "@madex/ex-ts-dao"; import { ormDB, noticeModel, noticeRead } from "@madex/ex-ts-dao";
import { ErrorCode } from "../../../constant/errorCode"; import { ErrorCode } from "../../../constant/errorCode";
import { addOptLog } from "./userOptLog.service";
let _ = require('lodash'); let _ = require('lodash');
...@@ -78,7 +79,7 @@ export async function list(noticePageVO: NoticePageVO) { ...@@ -78,7 +79,7 @@ export async function list(noticePageVO: NoticePageVO) {
return resList; return resList;
} }
export async function add(noticeVO: NoticeVO) { export async function add(noticeVO: NoticeVO, currentUserId: any, ip: any) {
let insertList: any = []; let insertList: any = [];
if (!noticeVO.publish_flag) { if (!noticeVO.publish_flag) {
...@@ -115,11 +116,13 @@ export async function add(noticeVO: NoticeVO) { ...@@ -115,11 +116,13 @@ export async function add(noticeVO: NoticeVO) {
} }
await noticeModel.prototype.bulkCreate(insertList); await noticeModel.prototype.bulkCreate(insertList);
//管理后台操作日志
addOptLog(currentUserId, 0, '新增消息推送', ip, JSON.stringify(noticeVO), '消息推送');
return 'success' return 'success'
} }
export async function update(noticeVO: NoticeVO) { export async function update(noticeVO: NoticeVO, currentUserId: any, ip: any) {
let dbInfo = await noticeModel.prototype.findOne({ let dbInfo = await noticeModel.prototype.findOne({
where: { where: {
...@@ -161,6 +164,9 @@ export async function update(noticeVO: NoticeVO) { ...@@ -161,6 +164,9 @@ export async function update(noticeVO: NoticeVO) {
id: Number(noticeVO.id) id: Number(noticeVO.id)
} }
}); });
//管理后台操作日志
addOptLog(currentUserId, 0, '更新消息推送', ip, JSON.stringify(noticeVO), '消息推送');
return 'success' return 'success'
} }
......
...@@ -31,6 +31,9 @@ import * as positionCtrl from "../../mvc/control/aclPosition.control"; ...@@ -31,6 +31,9 @@ import * as positionCtrl from "../../mvc/control/aclPosition.control";
import * as orderPendingAndHistoryCtrl from "../../mvc/control/mUserOrderPendingAndHistory.control"; import * as orderPendingAndHistoryCtrl from "../../mvc/control/mUserOrderPendingAndHistory.control";
import * as appVersionCtrl from "../../mvc/control/appVersion.control"; import * as appVersionCtrl from "../../mvc/control/appVersion.control";
import * as appApplyVersionCtrl from "../../mvc/control/appApplyVersion.control"; import * as appApplyVersionCtrl from "../../mvc/control/appApplyVersion.control";
import * as appDynamicDomainCtrl from "../../mvc/control/appDynamicDomain.control";
import * as appSpecialModelCtrl from "../../mvc/control/appSpecialModel.control";
import * as appFeatureCtrl from "../../mvc/control/appFeature.control";
const getFunc = { const getFunc = {
'user/info': userController.getUserInfo, 'user/info': userController.getUserInfo,
...@@ -156,10 +159,20 @@ const postFunc = { ...@@ -156,10 +159,20 @@ const postFunc = {
'tech/app/version/list': appVersionCtrl.list, 'tech/app/version/list': appVersionCtrl.list,
'tech/app/version/add': appVersionCtrl.add, 'tech/app/version/add': appVersionCtrl.add,
'tech/app/version/update': appVersionCtrl.update, 'tech/app/version/update': appVersionCtrl.update,
//技术部-App首页入口管理
'tech/app/feature/list': appFeatureCtrl.list,
'tech/app/feature/add': appFeatureCtrl.add,
'tech/app/feature/update': appFeatureCtrl.update,
'tech/app/feature/del': appFeatureCtrl.del,
//技术部-App审核管理 //技术部-App审核管理
'tech/app/apply/version/list': appApplyVersionCtrl.list, 'tech/app/apply/version/list': appApplyVersionCtrl.list,
'tech/app/apply/version/modify': appApplyVersionCtrl.modify, 'tech/app/apply/version/modify': appApplyVersionCtrl.modify,
//技术部-App动态域名
'tech/app/dynamic/domain/get': appDynamicDomainCtrl.get,
'tech/app/dynamic/domain/update': appDynamicDomainCtrl.update,
//技术部-App特定机型配置
'tech/app/special/model/get': appSpecialModelCtrl.get,
'tech/app/special/model/update': appSpecialModelCtrl.update,
}; };
// TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。 // TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。
......
...@@ -118,10 +118,20 @@ let cmdWhiteList = { ...@@ -118,10 +118,20 @@ let cmdWhiteList = {
'tech/app/version/list': 1, 'tech/app/version/list': 1,
'tech/app/version/add': 1, 'tech/app/version/add': 1,
'tech/app/version/update': 1, 'tech/app/version/update': 1,
//技术部-App首页入口管理
'tech/app/feature/list': 1,
'tech/app/feature/add': 1,
'tech/app/feature/update': 1,
'tech/app/feature/del': 1,
//技术部-App审核管理 //技术部-App审核管理
'tech/app/apply/version/list': 1, 'tech/app/apply/version/list': 1,
'tech/app/apply/version/modify': 1, 'tech/app/apply/version/modify': 1,
//技术部-App动态域名
'tech/app/dynamic/domain/get': 1,
'tech/app/dynamic/domain/update': 1,
//技术部-App特定机型配置
'tech/app/special/model/get': 1,
'tech/app/special/model/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