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
50e8f611
Commit
50e8f611
authored
Sep 21, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
逻辑调整、新增接口
parent
67bfdb79
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
634 additions
and
15039 deletions
+634
-15039
package-lock.json
package-lock.json
+0
-15008
errorCode.ts
src/constant/errorCode.ts
+2
-0
redis-val.ts
src/constant/redis-val.ts
+18
-1
appApplyVersion.control.ts
src/functional/mvc/control/appApplyVersion.control.ts
+1
-1
appDynamicDomain.control.ts
src/functional/mvc/control/appDynamicDomain.control.ts
+105
-0
appFeature.control.ts
src/functional/mvc/control/appFeature.control.ts
+144
-0
appSpecialModel.control.ts
src/functional/mvc/control/appSpecialModel.control.ts
+109
-0
hotPairConfig.control.ts
src/functional/mvc/control/hotPairConfig.control.ts
+11
-3
i18n.control.ts
src/functional/mvc/control/i18n.control.ts
+11
-6
i18nlog.control.ts
src/functional/mvc/control/i18nlog.control.ts
+5
-4
notice.control.ts
src/functional/mvc/control/notice.control.ts
+9
-2
appFeature.service.ts
src/functional/mvc/service/appFeature.service.ts
+153
-0
appVersion.service.ts
src/functional/mvc/service/appVersion.service.ts
+2
-0
hotPairConfig.service.ts
src/functional/mvc/service/hotPairConfig.service.ts
+10
-3
i18n.service.ts
src/functional/mvc/service/i18n.service.ts
+13
-3
i18nlog.service.ts
src/functional/mvc/service/i18nlog.service.ts
+8
-4
notice.service.ts
src/functional/mvc/service/notice.service.ts
+8
-2
index.ts
src/functional/router/v1/index.ts
+14
-1
access-limit.ts
src/setting/access-limit.ts
+11
-1
No files found.
package-lock.json
deleted
100644 → 0
View file @
67bfdb79
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/constant/errorCode.ts
View file @
50e8f611
...
...
@@ -55,4 +55,6 @@ export const ErrorCode = {
IP_ADDR_LIMIT
:
'30051'
,
//ip地址受限或不在您配置的IP白名单中
DEPARTMENT_HAS_USER
:
'30052'
,
//当前部门下有用户存在,不允许修改或删除
PWD_ILLEGAL
:
'30053'
,
//密码过短或过长
FIXED_AND_DEFAULT
:
'30054'
,
//固定和默认不能同时为是
NOT_HIDDEN_TWO
:
'30055'
,
//每种语言非隐藏并且固定的至少要有2个
}
src/constant/redis-val.ts
View file @
50e8f611
...
...
@@ -15,4 +15,21 @@ export const RedisVal = {
/**
* App审核管理
*/
export
const
APP_VERSION_KEY
=
"app:apply:version:"
;
// 防止之后会有android
\ No newline at end of file
export
const
APP_VERSION_KEY
=
"app:apply:version:"
;
// 防止之后会有android
/**
* 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"
;
src/functional/mvc/control/appApplyVersion.control.ts
View file @
50e8f611
...
...
@@ -21,7 +21,7 @@ export const list = async (req: any, pageVO: AppVersionPageVO) => {
let
key
=
APP_VERSION_KEY
+
'ios'
;
let
data
=
await
RedisClient
.
getSync
(
key
);
let
res
=
{
ios
:
data
ios
:
data
?
data
:
""
}
return
Res3Utils
.
result
(
res
);
}
...
...
src/functional/mvc/control/appDynamicDomain.control.ts
0 → 100644
View file @
50e8f611
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
);
}
};
src/functional/mvc/control/appFeature.control.ts
0 → 100644
View file @
50e8f611
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
}
}
}
src/functional/mvc/control/appSpecialModel.control.ts
0 → 100644
View file @
50e8f611
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
);
}
};
src/functional/mvc/control/hotPairConfig.control.ts
View file @
50e8f611
...
...
@@ -3,6 +3,8 @@ import { HotPairConfigVO, HotPairConfigPageVO } from "../service/hotPairConfig.s
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
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) => {
try
{
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
hotPairConfigVO
.
pair
);
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
);
}
catch
(
e
)
{
...
...
@@ -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
.
pair
);
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
);
}
catch
(
e
)
{
...
...
@@ -70,7 +76,9 @@ export const del = async (req: any, hotPairConfigVO: HotPairConfigVO) => {
let
func_name
=
"hotPairConfigCtrl.del"
;
try
{
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
);
}
catch
(
e
)
{
...
...
src/functional/mvc/control/i18n.control.ts
View file @
50e8f611
import
*
as
i18nService
from
"../service/i18n.service"
;
import
{
I18nInfoVO
,
I18nInfoPageVO
}
from
"../service/i18n.service"
;
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'
);
...
...
@@ -15,9 +17,6 @@ export const list = async (req: any, infoPageVO: I18nInfoPageVO) => {
try
{
infoPageVO
.
page
=
Optional
.
opt
(
infoPageVO
,
'page'
,
1
);
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
);
return
Res3Utils
.
result
(
res
);
...
...
@@ -37,7 +36,9 @@ export const add = async (req: any, infoVO: I18nInfoVO) => {
let
cmd
=
req
.
path
;
try
{
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
);
}
catch
(
e
)
{
...
...
@@ -55,7 +56,9 @@ export const update = async (req: any, infoVO: I18nInfoVO) => {
let
cmd
=
req
.
path
;
try
{
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
);
}
catch
(
e
)
{
...
...
@@ -73,7 +76,9 @@ export const del = async (req: any, infoVO: I18nInfoVO) => {
let
cmd
=
req
.
path
;
try
{
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
);
}
catch
(
e
)
{
...
...
src/functional/mvc/control/i18nlog.control.ts
View file @
50e8f611
import
*
as
i18nLogService
from
"../service/i18nlog.service"
;
import
{
I18nInfoLogVO
}
from
"../service/i18nlog.service"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
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) => {
try
{
i18nInfoLogVO
.
page
=
Optional
.
opt
(
i18nInfoLogVO
,
'page'
,
1
);
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
);
return
Res3Utils
.
result
(
res
);
}
...
...
@@ -35,9 +34,11 @@ export const revert = async (req: any, i18nInfoLogVO: I18nInfoLogVO) => {
let
func_name
=
"i18nLogCtrl.revert"
;
let
cmd
=
req
.
path
;
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
);
let
res
=
await
i18nLogService
.
revert
(
i18nInfoLogVO
);
let
res
=
await
i18nLogService
.
revert
(
i18nInfoLogVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
...
...
src/functional/mvc/control/notice.control.ts
View file @
50e8f611
...
...
@@ -3,6 +3,9 @@ import { NoticeVO, NoticePageVO } from "../service/notice.service";
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
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) => {
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
noticeVO
.
content
);
ApiAssert
.
notNull
(
ErrorCode
.
PARAM_MISS
,
noticeVO
.
notice_type
);
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
);
}
catch
(
e
)
{
...
...
@@ -55,7 +60,9 @@ export const update = async (req: any, noticeVO: NoticeVO) => {
let
func_name
=
"noticeCtrl.update"
;
try
{
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
);
}
catch
(
e
)
{
...
...
src/functional/mvc/service/appFeature.service.ts
0 → 100644
View file @
50e8f611
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'
;
}
src/functional/mvc/service/appVersion.service.ts
View file @
50e8f611
...
...
@@ -90,6 +90,7 @@ export async function add(appVersionVO: AppVersionVO, currentUserId: any, ip: st
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'新增App版本'
,
ip
,
JSON
.
stringify
(
appVersionVO
),
'App版本管理'
);
return
'success'
;
}
...
...
@@ -126,6 +127,7 @@ export async function update(appVersionVO: AppVersionVO, currentUserId: any, ip:
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'修改App版本'
,
ip
,
JSON
.
stringify
(
appVersionVO
),
'App版本管理'
);
return
'success'
;
}
...
...
src/functional/mvc/service/hotPairConfig.service.ts
View file @
50e8f611
import
{
ormDB
,
hotPairConfig
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
...
...
@@ -43,7 +44,7 @@ export async function list(pair: any, page: number, size: number) {
return
resList
;
}
export
async
function
add
(
hotPairConfigVO
:
HotPairConfigVO
)
{
export
async
function
add
(
hotPairConfigVO
:
HotPairConfigVO
,
currentUserId
:
any
,
ip
:
any
)
{
let
dbInfo
=
await
hotPairConfig
.
prototype
.
findOne
({
where
:
{
...
...
@@ -59,11 +60,13 @@ export async function add(hotPairConfigVO: HotPairConfigVO) {
hotPairConfigVO
.
updatedAt
=
new
Date
();
await
hotPairConfig
.
prototype
.
create
(
hotPairConfigVO
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'新增热门搜索交易对配置'
,
ip
,
JSON
.
stringify
(
hotPairConfigVO
),
'热门搜索交易对配置'
);
return
'success'
}
export
async
function
update
(
hotPairConfigVO
:
HotPairConfigVO
)
{
export
async
function
update
(
hotPairConfigVO
:
HotPairConfigVO
,
currentUserId
:
any
,
ip
:
any
)
{
let
dbInfo
=
await
hotPairConfig
.
prototype
.
findOne
({
where
:
{
...
...
@@ -86,11 +89,13 @@ export async function update(hotPairConfigVO: HotPairConfigVO) {
id
:
Number
(
hotPairConfigVO
.
id
)
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'修改热门搜索交易对配置'
,
ip
,
JSON
.
stringify
(
hotPairConfigVO
),
'热门搜索交易对配置'
);
return
'success'
}
export
async
function
del
(
id
:
number
)
{
export
async
function
del
(
id
:
number
,
currentUserId
:
any
,
ip
:
any
)
{
let
dbInfo
=
await
hotPairConfig
.
prototype
.
findOne
({
where
:
{
...
...
@@ -108,6 +113,8 @@ export async function del(id: number) {
id
:
Number
(
id
)
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'删除热门搜索交易对配置'
,
ip
,
`id:
${
id
}
`
,
'热门搜索交易对配置'
);
return
'success'
}
...
...
src/functional/mvc/service/i18n.service.ts
View file @
50e8f611
...
...
@@ -2,6 +2,7 @@
import
{
i18nInfo
,
i18nInfoLog
,
ormDB
}
from
"@madex/ex-ts-dao"
;
import
*
as
i18nLogService
from
"../service/i18nlog.service"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
let
{
logger
}
=
require
(
'@madex/ex-js-public'
);
...
...
@@ -62,7 +63,7 @@ export const list = async (infoPageVO: I18nInfoPageVO) => {
});
return
resList
;
};
export
const
add
=
async
(
infoVO
:
I18nInfoVO
)
=>
{
export
const
add
=
async
(
infoVO
:
I18nInfoVO
,
currentUserId
:
any
,
ip
:
any
)
=>
{
if
(
!
infoVO
.
createdAt
)
{
infoVO
.
createdAt
=
new
Date
();
}
...
...
@@ -82,10 +83,13 @@ export const add = async (infoVO: I18nInfoVO) => {
throw
ErrorCode
.
DATA_EXIST
;
}
await
i18nInfo
.
prototype
.
create
(
infoVO
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'新增国际化信息'
,
ip
,
JSON
.
stringify
(
infoVO
),
'国际化管理'
);
return
'ok'
;
};
export
const
update
=
async
(
infoVO
:
I18nInfoVO
)
=>
{
export
const
update
=
async
(
infoVO
:
I18nInfoVO
,
currentUserId
:
any
,
ip
:
any
)
=>
{
let
transaction
:
any
;
try
{
let
dbOneI18nInfo
=
await
i18nInfo
.
prototype
.
findOne
({
...
...
@@ -97,6 +101,7 @@ export const update = async (infoVO: I18nInfoVO) => {
if
(
!
dbOneI18nInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
;
}
delete
infoVO
.
id
;
let
i18nInfoLogOne
=
await
buildOneI18nInfoLog
(
dbOneI18nInfo
,
infoVO
);
...
...
@@ -112,6 +117,9 @@ export const update = async (infoVO: I18nInfoVO) => {
//日志
await
i18nLogService
.
add
(
i18nInfoLogOne
,
transaction
);
await
transaction
.
commit
();
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'修改国际化信息'
,
ip
,
JSON
.
stringify
(
infoVO
),
'国际化管理'
);
return
'ok'
;
}
catch
(
e
)
{
...
...
@@ -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
;
try
{
let
dbOneI18nInfo
=
await
i18nInfo
.
prototype
.
findOne
({
...
...
@@ -151,6 +159,8 @@ export const del = async (infoVO: I18nInfoVO) => {
//日志
await
i18nLogService
.
add
(
i18nInfoLogOne
,
transaction
);
await
transaction
.
commit
();
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'删除国际化信息'
,
ip
,
JSON
.
stringify
(
infoVO
),
'国际化管理'
);
return
'ok'
;
}
catch
(
e
)
{
...
...
src/functional/mvc/service/i18nlog.service.ts
View file @
50e8f611
...
...
@@ -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
({
raw
:
true
,
where
:
{
...
...
@@ -81,8 +81,7 @@ export async function revert(i18nInfoLogVO: I18nInfoLogVO) {
updatedAt
:
dbOneI18nInfoLog
.
updatedAt
,
}
if
(
!
dbOneI18nInfo
)
{
await
i18nService
.
add
(
itemInfo
);
return
'ok'
;
await
i18nService
.
add
(
itemInfo
,
currentUserId
,
ip
);
}
else
{
delete
itemInfo
.
createdAt
;
...
...
@@ -91,7 +90,12 @@ export async function revert(i18nInfoLogVO: I18nInfoLogVO) {
id
:
infoId
}
});
return
'ok'
;
}
await
i18nInfoLog
.
prototype
.
destroy
({
where
:
{
id
:
Number
(
i18nInfoLogVO
.
id
)
}
});
return
'ok'
;
}
\ No newline at end of file
src/functional/mvc/service/notice.service.ts
View file @
50e8f611
import
{
ormDB
,
noticeModel
,
noticeRead
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
let
_
=
require
(
'lodash'
);
...
...
@@ -78,7 +79,7 @@ export async function list(noticePageVO: NoticePageVO) {
return
resList
;
}
export
async
function
add
(
noticeVO
:
NoticeVO
)
{
export
async
function
add
(
noticeVO
:
NoticeVO
,
currentUserId
:
any
,
ip
:
any
)
{
let
insertList
:
any
=
[];
if
(
!
noticeVO
.
publish_flag
)
{
...
...
@@ -115,11 +116,13 @@ export async function add(noticeVO: NoticeVO) {
}
await
noticeModel
.
prototype
.
bulkCreate
(
insertList
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'新增消息推送'
,
ip
,
JSON
.
stringify
(
noticeVO
),
'消息推送'
);
return
'success'
}
export
async
function
update
(
noticeVO
:
NoticeVO
)
{
export
async
function
update
(
noticeVO
:
NoticeVO
,
currentUserId
:
any
,
ip
:
any
)
{
let
dbInfo
=
await
noticeModel
.
prototype
.
findOne
({
where
:
{
...
...
@@ -161,6 +164,9 @@ export async function update(noticeVO: NoticeVO) {
id
:
Number
(
noticeVO
.
id
)
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'更新消息推送'
,
ip
,
JSON
.
stringify
(
noticeVO
),
'消息推送'
);
return
'success'
}
...
...
src/functional/router/v1/index.ts
View file @
50e8f611
...
...
@@ -31,6 +31,9 @@ import * as positionCtrl from "../../mvc/control/aclPosition.control";
import
*
as
orderPendingAndHistoryCtrl
from
"../../mvc/control/mUserOrderPendingAndHistory.control"
;
import
*
as
appVersionCtrl
from
"../../mvc/control/appVersion.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
=
{
'user/info'
:
userController
.
getUserInfo
,
...
...
@@ -156,10 +159,20 @@ const postFunc = {
'tech/app/version/list'
:
appVersionCtrl
.
list
,
'tech/app/version/add'
:
appVersionCtrl
.
add
,
'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审核管理
'tech/app/apply/version/list'
:
appApplyVersionCtrl
.
list
,
'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 的注册路由方式保持一样,后面在调整。
...
...
src/setting/access-limit.ts
View file @
50e8f611
...
...
@@ -118,10 +118,20 @@ let cmdWhiteList = {
'tech/app/version/list'
:
1
,
'tech/app/version/add'
:
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审核管理
'tech/app/apply/version/list'
:
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
,
};
...
...
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