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
da39d69d
Commit
da39d69d
authored
Dec 10, 2024
by
1486327116
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
82024ffd
64503208
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
535 additions
and
273 deletions
+535
-273
菜单权限分块.txt
docs/菜单权限分块.txt
+81
-0
errorCode.ts
src/constant/errorCode.ts
+2
-0
coinType.control.ts
src/functional/mvc/control/coinType.control.ts
+31
-0
i18n.control.ts
src/functional/mvc/control/i18n.control.ts
+11
-28
i18nlog.control.ts
src/functional/mvc/control/i18nlog.control.ts
+6
-4
systemTrigger.control.ts
src/functional/mvc/control/systemTrigger.control.ts
+17
-9
coinType.service.ts
src/functional/mvc/service/coinType.service.ts
+51
-1
i18n.service.ts
src/functional/mvc/service/i18n.service.ts
+238
-153
i18nlog.service.ts
src/functional/mvc/service/i18nlog.service.ts
+82
-68
index.ts
src/functional/router/v1/index.ts
+8
-6
access-limit.ts
src/setting/access-limit.ts
+6
-4
login-filter.ts
src/setting/login-filter.ts
+2
-0
No files found.
docs/菜单权限分块.txt
0 → 100644
View file @
da39d69d
权限菜单分块
+++ 权限管理(menu:auth_manage)
++++++++++++++++++++++++++++ 我的权限(menu:my_auth)
++++++++++++++++++++++++++++ 组织结构(menu:org_structure)
++++++++++++++++++++++++++++ 后台角色管理(menu:end_role_manage)
++++++++++++++++++++++++++++ 后台用户管理(menu:end_user_manage)
**********************************************************************************************************************************************
+++ 客服部(menu:customer_department)
++++++++++++++++++++++++++++ 用户管理(menu:m_user_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 用户列表(menu:m_user_list)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 用户详情(menu:m_user_detail)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 实名认证(menu:kyc_manage)
++++++++++++++++++++++++++++ 资金管理(menu:cus_fund_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 充值管理(menu:cus_fund_deposit_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 提现管理(menu:cus_fund_withdraw_manage)
**********************************************************************************************************************************************
+++ 金融部(menu:finance_department)
++++++++++++++++++++++++++++ 交易管理(menu:f_trade_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 交易对配置(menu:trade_pair_config)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 合约代码配置(menu:contract_pair_config)
++++++++++++++++++++++++++++ 金融其他管理(menu:f_other_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 现货做市参数配置(menu:spot_market_maker_config)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 合约做市参数配置(menu:contract_market_maker_config)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 合约限制交易配置(menu:contract_limit_trade_config)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 合约接单账户配置(menu:contract_agent_config)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 合约接单账户关联(menu:contract_agent_user_config)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 合约渠道用户管理(menu:contract_agent_channel_config)
**********************************************************************************************************************************************
+++ 运营部(menu:operate_department)
++++++++++++++++++++++++++++ 现货(menu:run_spot)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ VIP管理(menu:common_user_fee_setting)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 资源管理(menu:resource_link)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 现货数据(menu:operate_spot_data)
++++++++++++++++++++++++++++ 合约(menu:run_contract)
++++++++++++++++++++++++++++ 活动管理(menu:run_active_manage)
++++++++++++++++++++++++++++ 其他管理(menu:run_other_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 邮件订阅(menu:user_subscribe)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 消息通知(menu:notice)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 热门交易对搜索配置(menu:hot_pair_config)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 币种管理(menu:run_other_symbol_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 交易区设置(menu:operate_other_business_area)
**********************************************************************************************************************************************
+++ 技术部(menu:tech_department)
++++++++++++++++++++++++++++ App管理(menu:app_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ App版本管理(menu:app_version_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ App首页入口管理(menu:app_feature_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ App审核管理(menu:app_apply_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ App动态域名(menu:app_address)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ App特别机型配置(menu:app_special_model)
++++++++++++++++++++++++++++ 技术部-其他管理(menu:tech_other_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 触发配置管理(menu:trigger_config_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ API限速管理(menu:api_key_strict_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 国际化管理(menu:i18n_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 返佣时间周期配置(menu:other_reward_time_period_config)
++++++++++++++++++++++++++++ 上币管理(menu:tech_coin_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 上币申请(menu:tech_coin_apply)
++++++++++++++++++++++++++++ 交易上下线管理(menu:tech_pair_manage)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 上交易对申请(menu:tech_pair_apply)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ 申请审核定时器(menu:tech_cron_apply)
**********************************************************************************************************************************************
+++ 市场部(menu:market_department)
**********************************************************************************************************************************************
+++ 商务部(menu:business_department)
src/constant/errorCode.ts
View file @
da39d69d
...
...
@@ -82,4 +82,6 @@ export const ErrorCode = {
PAIR_IS_NOT_ACTIVE
:
'30078'
,
//交易对已是未激活状态
PAIR_IS_HIDE
:
'30079'
,
//交易对已是隐藏状态
PAIR_IS_NOT_HIDE
:
'30080'
,
//交易对已是未隐藏状态
STATUS_PASS_NO_UP
:
'30081'
,
//审核已通过,不允许修改
AFTER_AUDIT_SUBMIT
:
'30082'
,
//请先审核,再提交
}
src/functional/mvc/control/coinType.control.ts
View file @
da39d69d
...
...
@@ -100,3 +100,34 @@ export const getAllSubmitSuccess = async (req: any, param: ListParam) => {
}
};
export
const
audit
=
async
(
req
:
any
,
param
:
AddParam
)
=>
{
let
func_name
=
"coinTypeCtl.audit"
;
let
cmd
=
req
.
path
;
try
{
ApiAssert
.
notNull
(
'3000'
,
param
.
id
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
service
.
audit
(
param
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
export
const
mixinCoinList
=
async
(
req
:
any
,
param
:
ListParam
)
=>
{
let
func_name
=
"coinTypeCtl.list"
;
let
cmd
=
req
.
path
;
try
{
param
.
page
=
Optional
.
opt
(
param
,
'page'
,
1
);
param
.
size
=
Optional
.
opt
(
param
,
'size'
,
50
);
let
res
=
await
service
.
mixinCoinList
(
param
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/control/i18n.control.ts
View file @
da39d69d
...
...
@@ -7,7 +7,7 @@ let isIp = require('is-ip');
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
/**
* 分页查询列表
* 分页查询
当前版本国际化信息
列表
* @param req
* @param infoVO
*/
...
...
@@ -27,7 +27,7 @@ export const list = async (req: any, infoPageVO: I18nInfoPageVO) => {
}
};
/**
* 添加国际化信息
* 添加国际化信息
-发布版本
* @param req
* @param infoVO
*/
...
...
@@ -35,7 +35,6 @@ export const add = async (req: any, infoVO: I18nInfoVO) => {
let
func_name
=
"i18nCtrl.add"
;
let
cmd
=
req
.
path
;
try
{
await
preCheck
(
infoVO
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
i18nService
.
add
(
infoVO
,
currentUserId
,
ip
);
...
...
@@ -46,19 +45,19 @@ export const add = async (req: any, infoVO: I18nInfoVO) => {
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
*
修改国际化信息
*
添加国际化信息-发布版本-预览
* @param req
* @param infoVO
*/
export
const
update
=
async
(
req
:
any
,
infoVO
:
I18nInfoVO
)
=>
{
let
func_name
=
"i18nCtrl.
update
"
;
export
const
preview
=
async
(
req
:
any
,
infoVO
:
I18nInfoVO
)
=>
{
let
func_name
=
"i18nCtrl.
preview
"
;
let
cmd
=
req
.
path
;
try
{
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
infoVO
.
id
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
i18nService
.
update
(
infoVO
,
currentUserId
,
ip
);
let
res
=
await
i18nService
.
preview
(
infoVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
...
...
@@ -67,18 +66,15 @@ export const update = async (req: any, infoVO: I18nInfoVO) => {
}
};
/**
*
删除国际化信息
*
国际化信息版本列表
* @param req
* @param infoVO
*/
export
const
del
=
async
(
req
:
any
,
infoVO
:
I18nInfoVO
)
=>
{
let
func_name
=
"i18nCtrl.
del
"
;
export
const
versionList
=
async
(
req
:
any
,
infoVO
:
I18nInfoVO
)
=>
{
let
func_name
=
"i18nCtrl.
versionList
"
;
let
cmd
=
req
.
path
;
try
{
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
infoVO
.
id
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
i18nService
.
del
(
infoVO
,
currentUserId
,
ip
);
let
res
=
await
i18nService
.
versionList
();
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
...
...
@@ -88,16 +84,3 @@ export const del = async (req: any, infoVO: I18nInfoVO) => {
};
/**
* 校验
* @param infoVO
*/
async
function
preCheck
(
infoVO
:
I18nInfoVO
)
{
if
(
!
[
1
,
2
,
3
,
4
,
5
].
includes
(
infoVO
.
platform
))
{
throw
ErrorCode
.
PARAM_MISS
;
}
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
infoVO
.
module
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
infoVO
.
code
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
infoVO
.
lang
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
infoVO
.
content
);
}
\ No newline at end of file
src/functional/mvc/control/i18nlog.control.ts
View file @
da39d69d
...
...
@@ -7,7 +7,7 @@ let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert } =
let
isIp
=
require
(
'is-ip'
);
/**
* 国际化信息
修改日志
列表
* 国际化信息
历史版本信息
列表
* @param req
* @param infoVO
*/
...
...
@@ -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
);
}
...
...
@@ -26,7 +29,7 @@ export const list = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => {
}
};
/**
*
还原(还原到修改之前)
*
版本回退
* @param req
* @param infoVO
*/
...
...
@@ -36,8 +39,7 @@ export const revert = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => {
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
.
info_id
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
i18nInfoLogVO
.
version
);
let
res
=
await
i18nLogService
.
revert
(
i18nInfoLogVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
...
...
src/functional/mvc/control/systemTrigger.control.ts
View file @
da39d69d
...
...
@@ -5,7 +5,7 @@ import { SystemTriggerVO, SystemTriggerPageVO } from "../service/systemTrigger.s
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
import
{
coinType
,
spotPairs
}
from
"@madex/ex-ts-dao"
;
import
{
coinType
,
contractPairs
,
spotPairs
}
from
"@madex/ex-ts-dao"
;
let
isIp
=
require
(
'is-ip'
);
/**
...
...
@@ -114,16 +114,24 @@ async function paramValid(systemTriggerVO: SystemTriggerVO) {
}
}
else
{
//TODO: 这个需要确定下 之前的有 激活 隐藏 开启/关闭充值 开启/关闭提现 开启/关闭划转 现在没有对应的 激活 隐藏对应的字段了
// 之前的 只有 ex_pair 现在现货和合约是分开的 查询的是 spot_pairs 是否需要补充别的查询合约交易对的逻辑???
// 触发活动(coin_type:1xxx -- is_active=0 : 1010,is_active=1 :1011 ,enable_deposit=0:1020,enable_deposit=1:1021, enable_withdraw=0:1030,enable_withdraw=1:1031,enable_transfer=0:1040,enable_transfer=1:1041;
// ex_pair:2xxx -- is_active=0:2010,is_active=1:2011, is_hide=0:2020,is_hide=1:2021)
let
dbInfo
=
await
spotPairs
.
prototype
.
findOne
({
let
dbInfo
:
any
;
if
(
symbolOrPair
.
endsWith
(
"_SWAP"
)){
dbInfo
=
await
contractPairs
.
prototype
.
findOne
({
where
:
{
symbol
:
symbolOrPair
},
raw
:
true
});
}
else
{
dbInfo
=
await
spotPairs
.
prototype
.
findOne
({
where
:
{
symbol
:
symbolOrPair
},
raw
:
true
});
}
if
(
!
dbInfo
)
{
throw
ErrorCode
.
PAIR_NOT_EXIST
}
...
...
src/functional/mvc/service/coinType.service.ts
View file @
da39d69d
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import
{
coinType
,
ormDB
,
spotPairs
}
from
"@madex/ex-ts-dao"
;
import
{
coinType
,
ormDB
,
spotPairs
,
mixinCoin
}
from
"@madex/ex-ts-dao"
;
import
{
addCoin2Core
}
from
"../../../utils/coreSystemUtils"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
...
...
@@ -150,6 +150,9 @@ export const update = async (param: AddParam, currentUserId: any, ip: any) => {
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
if
(
dbInfo
.
audit_status
)
{
//审核通过后不可修改
throw
ErrorCode
.
STATUS_PASS_NO_UP
}
param
.
updatedAt
=
new
Date
();
await
coinType
.
prototype
.
update
(
param
,
{
where
:
{
id
:
id
}
...
...
@@ -169,6 +172,9 @@ export const pushToCoreSystem = async (id: any, currentUserId: any, ip: any) =>
if
(
!
cfg
)
{
throw
ErrorCode
.
SUBMIT_STATUS_OR_MAIN_ERR
;
}
if
(
!
cfg
.
audit_status
)
{
throw
ErrorCode
.
AFTER_AUDIT_SUBMIT
;
}
let
symbol
=
cfg
.
general_name
;
let
optResult
=
await
addCoin2Core
(
symbol
,
cfg
.
id
);
...
...
@@ -196,3 +202,47 @@ export async function getAllSubmitSuccess() {
});
return
resList
;
}
export
const
audit
=
async
(
param
:
AddParam
,
currentUserId
:
any
,
ip
:
any
)
=>
{
let
id
=
param
.
id
;
let
dbInfo
=
await
coinType
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
param
.
updatedAt
=
new
Date
();
if
(
!
dbInfo
.
audit_status
)
{
await
coinType
.
prototype
.
update
({
audit_status
:
1
,
},
{
where
:
{
id
:
id
}
})
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'币种管理审核'
,
ip
,
JSON
.
stringify
(
param
),
'币种管理'
);
}
return
'ok'
;
};
export
async
function
mixinCoinList
(
param
:
ListParam
)
{
let
where
=
{};
if
(
param
.
symbol
)
{
where
[
"symbol"
]
=
{
[
ormDB
.
Op
.
like
]:
`%
${
param
.
symbol
}
%`
};
}
let
resList
=
await
mixinCoin
.
prototype
.
findAndCount
({
attributes
:[
'symbol'
,
'name'
,
'symbol_id'
,
'display_symbol'
,
'chain_id'
,
'address'
,
'precision'
,
'dust'
,
'confirm'
,
'price_btc'
,
'price_usd'
,
'balance'
,
'comment'
],
where
:
where
,
limit
:
param
.
size
,
offset
:
(
param
.
page
-
1
)
*
param
.
size
,
order
:
[[
"symbol"
,
"asc"
]],
raw
:
true
});
return
resList
;
}
\ No newline at end of file
src/functional/mvc/service/i18n.service.ts
View file @
da39d69d
This diff is collapsed.
Click to expand it.
src/functional/mvc/service/i18nlog.service.ts
View file @
da39d69d
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import
{
i18nInfo
,
i18nInfo
Log
,
ormDB
}
from
"@madex/ex-ts-dao"
;
import
{
i18nInfo
,
i18nInfo
History
,
ormDB
}
from
"@madex/ex-ts-dao"
;
import
*
as
i18nService
from
"./i18n.service"
;
import
{
I18nInfoPageVO
,
I18nInfoVO
}
from
"./i18n.service"
;
import
{
getLastVersionList
,
I18nInfoPageVO
,
I18nInfoVO
}
from
"./i18n.service"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
import
{
ROBOT_KEYS
,
sendRobotMessage
}
from
"../../../utils/robotUtils"
;
let
{
logger
}
=
require
(
'@madex/ex-js-public'
);
export
interface
I18nInfoLogVO
extends
I18nInfoPageVO
{
info_id
?:
number
;
version
:
string
;
}
export
async
function
list
(
i18nInfoLogVO
:
I18nInfoLogVO
)
{
if
(
i18nInfoLogVO
.
code
)
{
i18nInfoLogVO
.
code
=
{
[
ormDB
.
Op
.
like
]:
`
${
i18nInfoLogVO
.
code
}
%`
};
let
condition
=
{
version
:
i18nInfoLogVO
.
version
};
if
(
i18nInfoLogVO
.
platform
)
{
condition
[
'platform'
]
=
Number
(
i18nInfoLogVO
.
platform
);
}
if
(
i18nInfoLogVO
.
sub_code
)
{
i18nInfoLogVO
.
sub_code
=
{
[
ormDB
.
Op
.
like
]:
`
${
i18nInfoLogVO
.
sub_code
}
%`
};
if
(
i18nInfoLogVO
.
module
)
{
condition
[
'module'
]
=
Number
(
i18nInfoLogVO
.
module
);
}
if
(
i18nInfoLogVO
.
desc
)
{
i18nInfoLogVO
.
desc
=
{
[
ormDB
.
Op
.
like
]:
`
${
i18nInfoLogVO
.
desc
}
%`
}
;
if
(
i18nInfoLogVO
.
code
)
{
condition
[
'code'
]
=
i18nInfoLogVO
.
code
;
}
if
(
i18nInfoLogVO
.
updatedAt
)
{
i18nInfoLogVO
.
updatedAt
=
{
[
ormDB
.
Op
.
gte
]:
new
Date
(
i18nInfoLogVO
.
updatedAt
).
getTime
()
};
if
(
i18nInfoLogVO
.
zh_cn
)
{
condition
[
'zh_cn'
]
=
{
[
ormDB
.
Op
.
like
]:
`
${
i18nInfoLogVO
.
zh_cn
}
%`
};
}
let
page
=
Number
(
i18nInfoLogVO
.
page
);
let
size
=
Number
(
i18nInfoLogVO
.
size
);
let
where
=
Object
.
assign
(
i18nInfoLogVO
);
delete
i18nInfoLogVO
.
page
;
delete
i18nInfoLogVO
.
size
;
let
resList
=
await
i18nInfoLog
.
prototype
.
findAndCount
({
where
:
where
,
let
resList
=
await
i18nInfoHistory
.
prototype
.
findAndCount
({
where
:
condition
,
limit
:
size
,
offset
:
(
page
-
1
)
*
size
,
order
:
[[
"
updatedAt"
,
"de
sc"
]],
order
:
[[
"
id"
,
"a
sc"
]],
raw
:
true
});
return
resList
;
}
export
const
add
=
async
(
infoLogVO
:
any
,
tx
:
any
)
=>
{
if
(
!
infoLogVO
.
createdAt
)
{
infoLogVO
.
createdAt
=
new
Date
();
}
if
(
!
infoLogVO
.
updatedAt
)
{
infoLogVO
.
updatedAt
=
new
Date
();
}
await
i18nInfoLog
.
prototype
.
create
(
infoLogVO
,
{
transaction
:
tx
,
});
};
export
async
function
revert
(
i18nInfoLogVO
:
I18nInfoLogVO
,
currentUserId
:
any
,
ip
:
any
)
{
let
dbOneI18nInfoLog
=
await
i18nInfoLog
.
prototype
.
findOne
({
raw
:
true
,
let
dbHistoryList
=
await
i18nInfoHistory
.
prototype
.
findAll
({
where
:
{
id
:
i18nInfoLogVO
.
id
}
version
:
i18nInfoLogVO
.
version
},
order
:
[[
'info_id'
,
'asc'
]],
raw
:
true
,
});
if
(
!
dbOneI18nInfoLog
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
;
let
insertInfoList
:
any
=
[];
let
insertHistoryList
:
any
=
[];
for
(
let
item
of
dbHistoryList
)
{
delete
item
.
info_id
;
delete
item
.
id
;
insertInfoList
.
push
(
item
);
}
let
infoId
=
dbOneI18nInfoLog
.
info_id
;
let
dbOneI18nInfo
=
await
i18nInfo
.
prototype
.
findOne
({
raw
:
true
,
where
:
{
id
:
infoId
let
currentVersionList
=
await
getLastVersionList
();
let
current_version
=
""
;
for
(
let
item
of
currentVersionList
)
{
current_version
=
item
.
version
;
let
info_id
=
item
.
id
;
item
.
info_id
=
info_id
;
item
.
createdAt
=
item
.
updatedAt
;
delete
item
.
id
;
insertHistoryList
.
push
(
item
)
}
let
tx
;
try
{
tx
=
await
ormDB
.
transaction
();
if
(
insertInfoList
.
length
)
{
//删除历史版本
await
i18nInfoHistory
.
prototype
.
destroy
({
where
:
{
version
:
i18nInfoLogVO
.
version
},
transaction
:
tx
});
let
itemInfo
=
{
platform
:
dbOneI18nInfoLog
.
platform
,
module
:
dbOneI18nInfoLog
.
module
,
code
:
dbOneI18nInfoLog
.
code
,
sub_code
:
dbOneI18nInfoLog
.
sub_code
,
lang
:
dbOneI18nInfoLog
.
lang
,
desc
:
dbOneI18nInfoLog
.
desc
,
content
:
dbOneI18nInfoLog
.
content
,
createdAt
:
dbOneI18nInfoLog
.
createdAt
,
updatedAt
:
dbOneI18nInfoLog
.
updatedAt
,
}
if
(
!
dbOneI18nInfo
)
{
await
i18nService
.
add
(
itemInfo
,
currentUserId
,
ip
);
//删除当前版本
await
i18nInfo
.
prototype
.
destroy
({
where
:
{},
transaction
:
tx
});
//当前版本存入历史
await
i18nInfoHistory
.
prototype
.
bulkCreate
(
insertHistoryList
,
{
transaction
:
tx
});
//恢复到传入的历史版本
await
i18nInfo
.
prototype
.
bulkCreate
(
insertInfoList
);
}
else
{
delete
itemInfo
.
createdAt
;
await
i18nInfo
.
prototype
.
update
(
itemInfo
,
{
where
:
{
id
:
infoId
await
tx
.
commit
();
}
});
catch
(
e
)
{
if
(
tx
)
{
await
tx
.
rollback
();
}
await
i18nInfoLog
.
prototype
.
destroy
({
where
:
{
id
:
Number
(
i18nInfoLogVO
.
id
)
logger
.
error
(
'i18nInfo.add.error:'
+
e
);
throw
e
;
}
});
return
'ok'
;
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'国际化信息版本回退'
,
ip
,
`当前版本:
${
current_version
}
,回退到:
${
i18nInfoLogVO
.
version
}
`
,
'国际化管理'
);
sendRobotMessage
(
ROBOT_KEYS
.
COMMON_KEY
,
`国际化信息版本回退:当前版本:
${
current_version
}
,回退到:
${
i18nInfoLogVO
.
version
}
`
);
return
'success'
;
}
\ No newline at end of file
src/functional/router/v1/index.ts
View file @
da39d69d
...
...
@@ -55,12 +55,12 @@ const getFunc = {
const
postFunc
=
{
//技术部-其他管理-国际化管理
'i18n/info/list'
:
i18nCtrl
.
list
,
'i18n/info/add'
:
i18nCtrl
.
add
,
'i18n/info/
update'
:
i18nCtrl
.
update
,
'i18n/info/
del'
:
i18nCtrl
.
del
,
'i18n/info/
log/list'
:
i18nLogCtrl
.
list
,
'i18n/info/
log/revert'
:
i18nLogCtrl
.
revert
,
'i18n/info/list'
:
i18nCtrl
.
list
,
//当前版本信息列表
'i18n/info/add'
:
i18nCtrl
.
add
,
//发布版本
'i18n/info/
preview'
:
i18nCtrl
.
preview
,
//发布版本-预览
'i18n/info/
version/list'
:
i18nCtrl
.
versionList
,
//版本列表
'i18n/info/
history/list'
:
i18nLogCtrl
.
list
,
//历史版本信息列表
'i18n/info/
history/revert'
:
i18nLogCtrl
.
revert
,
//版本回退
//金融部-交易管理-交易对配置
'spotPair/save'
:
spotPairCtrl
.
save
,
//新增
'spotPair/update'
:
spotPairCtrl
.
update
,
//修改
...
...
@@ -80,6 +80,8 @@ const postFunc = {
'coinType/list'
:
coinTypeCtrl
.
list
,
'coinType/pushToCoreSystem'
:
coinTypeCtrl
.
pushToCoreSystem
,
'coinType/getAllSubmitSuccess'
:
coinTypeCtrl
.
getAllSubmitSuccess
,
'coinType/audit'
:
coinTypeCtrl
.
audit
,
'coinType/mixinCoinList'
:
coinTypeCtrl
.
mixinCoinList
,
//权限管理 - 我的权限
'user/getInfo'
:
userOptCtrl
.
getInfo
,
...
...
src/setting/access-limit.ts
View file @
da39d69d
...
...
@@ -12,10 +12,10 @@ let cmdWhiteList = {
//技术部-其他管理-国际化管理
'i18n/info/list'
:
1
,
'i18n/info/add'
:
1
,
'i18n/info/
update
'
:
1
,
'i18n/info/
del
'
:
1
,
'i18n/info/
log
/list'
:
1
,
'i18n/info/
log
/revert'
:
1
,
'i18n/info/
preview
'
:
1
,
'i18n/info/
version/list
'
:
1
,
'i18n/info/
history
/list'
:
1
,
'i18n/info/
history
/revert'
:
1
,
//金融部-交易管理-交易对配置
'spotPair/save'
:
1
,
'spotPair/update'
:
1
,
...
...
@@ -34,6 +34,8 @@ let cmdWhiteList = {
'coinType/list'
:
1
,
'coinType/pushToCoreSystem'
:
1
,
'coinType/getAllSubmitSuccess'
:
1
,
'coinType/audit'
:
1
,
'coinType/mixinCoinList'
:
1
,
//权限管理 - 我的权限
'user/getInfo'
:
1
,
...
...
src/setting/login-filter.ts
View file @
da39d69d
...
...
@@ -16,11 +16,13 @@ const ExcludeApi = {
"user/login/confirm"
:
1
,
"mUser/fee/vip/level/list"
:
1
,
"spotPair/getAllSubmitSuccess"
:
1
,
"contractPair/getAllSubmitSuccess"
:
1
,
"coinType/getAllSubmitSuccess"
:
1
,
'acl/role/getAll'
:
1
,
'position/allList'
:
1
,
'department/allList'
:
1
,
'operate/other/business/area/list'
:
1
,
'coinType/mixinCoinList'
:
1
,
};
//管理员需要强制绑定,该位置做特殊处理
const
AdminExcludeApi
=
{
...
...
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