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
4f294b97
Commit
4f294b97
authored
Sep 26, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加接口、逻辑调整
parent
dfed33d2
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
476 additions
and
41 deletions
+476
-41
errorCode.ts
src/constant/errorCode.ts
+1
-1
coinType.control.ts
src/functional/mvc/control/coinType.control.ts
+50
-8
contractAgent.control.ts
src/functional/mvc/control/contractAgent.control.ts
+140
-0
spotPair.control.ts
src/functional/mvc/control/spotPair.control.ts
+8
-2
coinType.service.ts
src/functional/mvc/service/coinType.service.ts
+80
-10
contractAgent.service.ts
src/functional/mvc/service/contractAgent.service.ts
+149
-0
contractMarketMaker.service.ts
src/functional/mvc/service/contractMarketMaker.service.ts
+1
-1
spotMarketMaker.service.ts
src/functional/mvc/service/spotMarketMaker.service.ts
+1
-3
spotPair.service.ts
src/functional/mvc/service/spotPair.service.ts
+10
-4
index.ts
src/functional/router/v1/index.ts
+18
-6
access-limit.ts
src/setting/access-limit.ts
+17
-6
login-filter.ts
src/setting/login-filter.ts
+1
-0
No files found.
src/constant/errorCode.ts
View file @
4f294b97
...
...
@@ -60,5 +60,5 @@ export const ErrorCode = {
COIN_TYPE_NOT_EXIST
:
'30056'
,
//指定币种不存在
PAIR_NOT_EXIST
:
'30057'
,
//指定币对不存在
LIMIT_ERROR
:
'30058'
,
//limit参数必须在10-2000之间
ADD_PAIR_TO_CORE_ERR
:
'30059'
,
//添加交易对提交到撮合失败
ADD_PAIR_TO_CORE_ERR
:
'30059'
,
//添加
币种/
交易对提交到撮合失败
}
src/functional/mvc/control/coinType.control.ts
View file @
4f294b97
import
*
as
service
from
"../service/coinType.service"
;
import
{
AddParam
,
ListParam
}
from
"../service/coinType.service"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
let
isIp
=
require
(
'is-ip'
);
export
const
list
=
async
(
req
:
any
,
param
:
ListParam
)
=>
{
let
func_name
=
"coinTypeCtl.list"
;
...
...
@@ -26,14 +28,15 @@ export const save = async (req: any, param: AddParam) => {
ApiAssert
.
notNull
(
'3000'
,
param
.
symbol
);
ApiAssert
.
notNull
(
'3000'
,
param
.
name
);
ApiAssert
.
notNull
(
'3000'
,
param
.
general_name
);
ApiAssert
.
isInt
(
'3000'
,
param
.
is_active
);
ApiAssert
.
isInt
(
'3000'
,
param
.
is_main
);
ApiAssert
.
isInt
(
'3000'
,
param
.
original_decimals
);
ApiAssert
.
isInt
(
'3000'
,
param
.
valid_decimals
);
ApiAssert
.
isInt
(
'3000'
,
param
.
deposit_confirm_count
);
ApiAssert
.
isInt
(
'3000'
,
param
.
safe_confirm_count
);
let
res
=
await
service
.
save
(
param
);
ApiAssert
.
notNull
(
'3000'
,
param
.
is_active
);
ApiAssert
.
notNull
(
'3000'
,
param
.
is_main
);
ApiAssert
.
notNull
(
'3000'
,
param
.
original_decimals
);
ApiAssert
.
notNull
(
'3000'
,
param
.
valid_decimals
);
ApiAssert
.
notNull
(
'3000'
,
param
.
deposit_confirm_count
);
ApiAssert
.
notNull
(
'3000'
,
param
.
safe_confirm_count
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
service
.
save
(
param
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
...
...
@@ -42,6 +45,30 @@ export const save = async (req: any, param: AddParam) => {
}
};
export
const
update
=
async
(
req
:
any
,
param
:
AddParam
)
=>
{
let
func_name
=
"coinTypeCtl.update"
;
let
cmd
=
req
.
path
;
try
{
ApiAssert
.
notNull
(
'3000'
,
param
.
id
);
ApiAssert
.
notNull
(
'3000'
,
param
.
symbol
);
ApiAssert
.
notNull
(
'3000'
,
param
.
name
);
ApiAssert
.
notNull
(
'3000'
,
param
.
general_name
);
ApiAssert
.
notNull
(
'3000'
,
param
.
is_active
);
ApiAssert
.
notNull
(
'3000'
,
param
.
is_main
);
ApiAssert
.
notNull
(
'3000'
,
param
.
original_decimals
);
ApiAssert
.
notNull
(
'3000'
,
param
.
valid_decimals
);
ApiAssert
.
notNull
(
'3000'
,
param
.
deposit_confirm_count
);
ApiAssert
.
notNull
(
'3000'
,
param
.
safe_confirm_count
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
service
.
update
(
param
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
export
const
pushToCoreSystem
=
async
(
req
:
any
,
id
:
any
)
=>
{
let
func_name
=
"coinTypeCtl.pushToCoreSystem"
;
...
...
@@ -56,3 +83,18 @@ export const pushToCoreSystem = async (req: any, id: any) => {
return
Res3Utils
.
getErrorResult
(
e
);
}
};
export
const
getAllSubmitSuccess
=
async
(
req
:
any
,
param
:
ListParam
)
=>
{
let
func_name
=
"coinTypeCtl.getAllSubmitSuccess"
;
let
cmd
=
req
.
path
;
try
{
let
res
=
await
service
.
getAllSubmitSuccess
();
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/control/contractAgent.control.ts
0 → 100644
View file @
4f294b97
import
*
as
contractAgentService
from
"../service/contractAgent.service"
;
import
{
AgentVO
,
AgentUserVO
,
AgentPageVO
}
from
"../service/contractAgent.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
let
isIp
=
require
(
'is-ip'
);
/**
* 金融部-其他管理-合约接单账户配置列表
* @param req
* @param infoVO
*/
export
const
agentList
=
async
(
req
:
any
,
pageVO
:
AgentPageVO
)
=>
{
let
func_name
=
"contractAgent.control.agentList"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
contractAgentService
.
agentList
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 金融部-其他管理-合约接单账户配置
* @param req
* @param authConfigVO
*/
export
const
agentSet
=
async
(
req
:
any
,
agentVO
:
AgentVO
)
=>
{
let
func_name
=
"contractAgent.control.agentSet"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
agentVO
.
adl_type
||
!
agentVO
.
user_id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
contractAgentService
.
agentSet
(
agentVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 金融部-其他管理-合约接单账户关联列表
* @param req
* @param infoVO
*/
export
const
agentUserList
=
async
(
req
:
any
,
pageVO
:
AgentPageVO
)
=>
{
let
func_name
=
"contractAgent.control.agentUserList"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
contractAgentService
.
agentUserList
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 金融部-其他管理-合约接单账户关联
* @param req
* @param authConfigVO
*/
export
const
agentUserSet
=
async
(
req
:
any
,
agentUserVO
:
AgentUserVO
)
=>
{
let
func_name
=
"contractAgent.control.agentUserSet"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
agentUserVO
.
agent_id
||
!
agentUserVO
.
user_id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
contractAgentService
.
agentUserSet
(
agentUserVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 金融部-其他管理-合约渠道用户管理列表
* @param req
* @param infoVO
*/
export
const
agentChannelList
=
async
(
req
:
any
,
pageVO
:
AgentPageVO
)
=>
{
let
func_name
=
"contractAgent.control.agentChannelList"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
contractAgentService
.
agentChannelList
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 金融部-其他管理-合约渠道用户管理
* @param req
* @param authConfigVO
*/
export
const
agentChannelSet
=
async
(
req
:
any
,
agentUserVO
:
AgentUserVO
)
=>
{
let
func_name
=
"contractAgent.control.agentChannelSet"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
agentUserVO
.
agent_id
||
!
agentUserVO
.
user_id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
contractAgentService
.
agentChannelSet
(
agentUserVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/control/spotPair.control.ts
View file @
4f294b97
import
*
as
service
from
"../service/spotPair.service"
;
import
{
AddParam
,
ListParam
}
from
"../service/spotPair.service"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
let
isIp
=
require
(
'is-ip'
);
export
const
list
=
async
(
req
:
any
,
param
:
ListParam
)
=>
{
...
...
@@ -31,7 +33,9 @@ export const save = async (req: any, param: AddParam) => {
ApiAssert
.
notNull
(
'3000'
,
param
.
quantity_scale
);
ApiAssert
.
notNull
(
'3000'
,
param
.
maker_fee
);
ApiAssert
.
notNull
(
'3000'
,
param
.
taker_fee
);
let
res
=
await
service
.
save
(
param
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
service
.
save
(
param
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
...
...
@@ -45,7 +49,9 @@ export const update = async (req: any, param: AddParam) => {
let
cmd
=
req
.
path
;
try
{
ApiAssert
.
notNull
(
'3000'
,
param
.
id
);
let
res
=
await
service
.
update
(
param
);
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
res
=
await
service
.
update
(
param
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
...
...
src/functional/mvc/service/coinType.service.ts
View file @
4f294b97
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import
{
coinType
,
ormDB
,
spotPairs
}
from
"@madex/ex-ts-dao"
;
import
{
addCoin2Core
,
addPairToCore
}
from
"../../../utils/coreSystemUtils"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
let
{
logger
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
export
interface
ListParam
{
symbol
:
string
|
any
;
...
...
@@ -9,6 +12,12 @@ export interface ListParam {
page
:
number
;
size
:
number
;
status
?:
number
from_time
?:
Date
|
any
to_time
?:
Date
|
any
}
export
interface
AddParam
{
...
...
@@ -86,6 +95,10 @@ export interface AddParam {
is_hidden
?:
number
;
main_status
?:
number
;
createdAt
?:
Date
|
any
,
updatedAt
?:
Date
|
any
,
}
...
...
@@ -94,6 +107,12 @@ export async function list(param: ListParam) {
if
(
param
.
symbol
)
{
where
[
"symbol"
]
=
{
[
ormDB
.
Op
.
like
]:
`%
${
param
.
symbol
}
%`
};
}
if
(
param
.
status
||
param
.
status
===
0
)
{
where
[
"main_status"
]
=
param
.
status
}
if
(
param
.
from_time
&&
param
.
to_time
)
{
where
[
'createdAt'
]
=
{
[
ormDB
.
Op
.
between
]:
[
param
.
from_time
,
param
.
to_time
]
}
}
let
resList
=
await
coinType
.
prototype
.
findAndCount
({
where
:
where
,
limit
:
param
.
size
,
...
...
@@ -104,18 +123,59 @@ export async function list(param: ListParam) {
return
resList
;
}
export
const
save
=
async
(
param
:
AddParam
)
=>
{
let
id
=
param
.
id
;
if
(
id
)
{
delete
param
.
id
await
coinType
.
prototype
.
update
(
param
,
{
where
:
{
id
:
id
}
})
export
const
save
=
async
(
param
:
AddParam
,
currentUserId
:
any
,
ip
:
any
)
=>
{
param
.
updatedAt
=
new
Date
();
param
.
createdAt
=
new
Date
();
let
tx
;
try
{
tx
=
await
ormDB
.
transaction
();
let
insertInfo
=
await
coinType
.
prototype
.
create
(
param
,
{
transaction
:
tx
});
//TODO:目前方便调试先注释掉,之后正式测试时候需要解开注释
/*//提交到撮合
if (param.is_main) {
let optResult = await addCoin2Core(insertInfo.general_name, insertInfo.id);
if (!optResult) {
throw ErrorCode.ADD_PAIR_TO_CORE_ERR;
}
await coinType.prototype.update({ main_status: 1 }, {
where: {
id: insertInfo.id
}
})
}*/
await
tx
.
commit
();
}
else
{
await
coinType
.
prototype
.
create
(
param
);
catch
(
e
)
{
logger
.
error
(
'coinTypeService.save.error:'
+
e
);
if
(
tx
)
{
await
tx
.
rollback
();
}
throw
e
;
}
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'币种管理新增'
,
ip
,
JSON
.
stringify
(
param
),
'币种管理'
);
return
'ok'
;
};
export
const
update
=
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
();
await
coinType
.
prototype
.
update
(
param
,
{
where
:
{
id
:
id
}
})
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'币种管理更新'
,
ip
,
JSON
.
stringify
(
param
),
'币种管理'
);
return
'ok'
;
};
...
...
@@ -129,7 +189,7 @@ export const pushToCoreSystem = async (id: any) => {
if
(
cfg
)
{
let
symbol
=
cfg
.
general_name
;
let
optResult
=
await
addCoin2Core
(
symbol
,
cfg
.
id
);
let
optResult
=
await
addCoin2Core
(
symbol
,
cfg
.
id
);
if
(
optResult
)
{
await
coinType
.
prototype
.
update
({
main_status
:
1
},
{
where
:
where
...
...
@@ -140,3 +200,13 @@ export const pushToCoreSystem = async (id: any) => {
};
export
async
function
getAllSubmitSuccess
()
{
let
resList
=
await
coinType
.
prototype
.
findAll
({
where
:
{
main_status
:
2
},
order
:
[[
"id"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
\ No newline at end of file
src/functional/mvc/service/contractAgent.service.ts
0 → 100644
View file @
4f294b97
import
{
userApikeyStrict
,
}
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'
);
let
{
authCommon
:
AuthCommon
,
redisUtilsCommon
:
RedisClient
,
}
=
require
(
'@madex/ex-js-common'
);
export
interface
AgentVO
{
id
?:
number
,
user_id
?:
number
;
adl_type
?:
number
;
enable
?:
number
;
createdAt
?:
Date
|
any
,
updatedAt
?:
Date
|
any
,
}
export
interface
AgentUserVO
{
id
?:
number
,
user_id
?:
number
;
agent_id
?:
number
;
createdAt
?:
Date
|
any
,
updatedAt
?:
Date
|
any
,
}
export
interface
AgentPageVO
extends
AgentVO
,
AgentUserVO
{
page
?:
number
,
size
?:
number
,
}
export
async
function
agentList
(
pageVO
:
AgentPageVO
)
{
let
key
=
'contractAgent.service.agentList'
;
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
let
list
=
await
RedisClient
.
getSync
(
key
);
let
res
=
{
count
:
list
?
list
.
length
:
0
,
rows
:
list
?
list
:
[]
}
return
res
;
}
export
async
function
agentSet
(
agentVO
:
AgentVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
agentVO
.
createdAt
=
new
Date
();
agentVO
.
updatedAt
=
new
Date
();
let
key
=
'contractAgent.service.agentList'
;
let
list
=
await
RedisClient
.
getSync
(
key
);
if
(
list
)
{
agentVO
.
id
=
list
.
length
+
1
;
list
.
push
(
agentVO
);
}
else
{
agentVO
.
id
=
1
;
list
=
[];
list
.
push
(
agentVO
);
}
await
RedisClient
.
writeSync
(
key
,
list
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'合约接单账户配置'
,
ip
,
JSON
.
stringify
(
agentVO
),
'合约接单账户配置'
);
return
'success'
;
}
export
async
function
agentUserList
(
pageVO
:
AgentPageVO
)
{
let
key
=
'contractAgent.service.agentUserList'
;
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
let
list
=
await
RedisClient
.
getSync
(
key
);
let
res
=
{
count
:
list
?
list
.
length
:
0
,
rows
:
list
?
list
:
[]
}
return
res
;
}
export
async
function
agentUserSet
(
agentUserVO
:
AgentUserVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
agentUserVO
.
createdAt
=
new
Date
();
agentUserVO
.
updatedAt
=
new
Date
();
let
key
=
'contractAgent.service.agentUserList'
;
let
list
=
await
RedisClient
.
getSync
(
key
);
if
(
list
)
{
agentUserVO
.
id
=
list
.
length
+
1
;
list
.
push
(
agentUserVO
);
}
else
{
agentUserVO
.
id
=
1
;
list
=
[];
list
.
push
(
agentUserVO
);
}
await
RedisClient
.
writeSync
(
key
,
list
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'合约接单账户关联配置'
,
ip
,
JSON
.
stringify
(
agentUserVO
),
'合约接单账户关联'
);
return
'success'
;
}
export
async
function
agentChannelList
(
pageVO
:
AgentPageVO
)
{
let
key
=
'contractAgent.service.agentChannelList'
;
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
let
list
=
await
RedisClient
.
getSync
(
key
);
let
res
=
{
count
:
list
?
list
.
length
:
0
,
rows
:
list
?
list
:
[]
}
return
res
;
}
export
async
function
agentChannelSet
(
agentUserVO
:
AgentUserVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
agentUserVO
.
createdAt
=
new
Date
();
agentUserVO
.
updatedAt
=
new
Date
();
let
key
=
'contractAgent.service.agentChannelList'
;
let
list
=
await
RedisClient
.
getSync
(
key
);
if
(
list
)
{
agentUserVO
.
id
=
list
.
length
+
1
;
list
.
push
(
agentUserVO
);
}
else
{
agentUserVO
.
id
=
1
;
list
=
[];
list
.
push
(
agentUserVO
);
}
await
RedisClient
.
writeSync
(
key
,
list
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'合约渠道用户配置'
,
ip
,
JSON
.
stringify
(
agentUserVO
),
'合约渠道用户管理'
);
return
'success'
;
}
src/functional/mvc/service/contractMarketMaker.service.ts
View file @
4f294b97
...
...
@@ -72,7 +72,7 @@ export async function paramGet(pair: string) {
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
let
key
=
'contractMarketMaker.service.paramGet'
;
let
map
=
await
RedisClient
.
getSync
(
key
);
let
res
=
map
?
map
[
pair
]
:
""
let
res
=
map
&&
map
[
pair
]
?
map
[
pair
]
:
""
return
res
;
}
...
...
src/functional/mvc/service/spotMarketMaker.service.ts
View file @
4f294b97
import
{
userApikeyStrict
,
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
...
...
@@ -71,7 +69,7 @@ export async function paramGet(pair: string) {
//TODO:目前在缓存里 方便调试 后期撮合搞定之后再修改
let
key
=
'spotMarketMaker.service.paramGet'
;
let
map
=
await
RedisClient
.
getSync
(
key
);
let
res
=
map
?
map
[
pair
]
:
""
let
res
=
map
&&
map
[
pair
]
?
map
[
pair
]
:
""
return
res
;
}
...
...
src/functional/mvc/service/spotPair.service.ts
View file @
4f294b97
...
...
@@ -3,6 +3,7 @@ import { spotPairs, madSpotOrmDB, coinType } from "@madex/ex-ts-dao";
import
{
NUMBER
}
from
"sequelize"
;
import
{
addPairToCore
}
from
"../../../utils/coreSystemUtils"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
let
{
logger
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
...
...
@@ -76,7 +77,7 @@ export async function list(param: ListParam) {
return
resList
;
}
export
const
save
=
async
(
param
:
AddParam
)
=>
{
export
const
save
=
async
(
param
:
AddParam
,
currentUserId
:
any
,
ip
:
any
)
=>
{
param
.
updatedAt
=
new
Date
();
param
.
createdAt
=
new
Date
();
let
tx
;
...
...
@@ -86,7 +87,8 @@ export const save = async (param: AddParam) => {
let
insertInfo
=
await
spotPairs
.
prototype
.
create
(
param
,
{
transaction
:
tx
});
//提交到撮合
//TODO:目前方便调试先注释掉,之后正式测试时候需要解开注释
/*//提交到撮合
let symbol = insertInfo.symbol;
let sps = symbol.split("_");
let base = sps[0];
...
...
@@ -108,7 +110,7 @@ export const save = async (param: AddParam) => {
id: insertInfo.id
},
transaction: tx
});
});
*/
await
tx
.
commit
();
}
catch
(
e
)
{
...
...
@@ -118,11 +120,13 @@ export const save = async (param: AddParam) => {
}
throw
e
;
}
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'交易对配置新增'
,
ip
,
JSON
.
stringify
(
param
),
'交易对配置'
);
return
'ok'
;
};
export
const
update
=
async
(
param
:
AddParam
)
=>
{
export
const
update
=
async
(
param
:
AddParam
,
currentUserId
:
any
,
ip
:
any
)
=>
{
let
dbInfo
=
await
spotPairs
.
prototype
.
findOne
({
where
:
{
id
:
param
.
id
...
...
@@ -148,6 +152,8 @@ export const update = async (param: AddParam) => {
id
:
Number
(
param
.
id
)
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'交易对配置更新'
,
ip
,
JSON
.
stringify
(
param
),
'交易对配置'
);
return
'ok'
;
};
...
...
src/functional/router/v1/index.ts
View file @
4f294b97
...
...
@@ -40,13 +40,14 @@ import * as contractPairCtrl from "../../mvc/control/contractPair.control";
import
*
as
spotMarketMakerCtrl
from
"../../mvc/control/spotMarketMaker.control"
;
import
*
as
contractMarketMakerCtrl
from
"../../mvc/control/contractMarketMaker.control"
;
import
*
as
contractLimitTradeCtrl
from
"../../mvc/control/contractLimitTrade.control"
;
import
*
as
contractAgentCtrl
from
"../../mvc/control/contractAgent.control"
;
const
getFunc
=
{
'user/info'
:
userController
.
getUserInfo
,
};
const
postFunc
=
{
//技术部-国际化管理
//技术部-
其他管理-
国际化管理
'i18n/info/list'
:
i18nCtrl
.
list
,
'i18n/info/add'
:
i18nCtrl
.
add
,
'i18n/info/update'
:
i18nCtrl
.
update
,
...
...
@@ -59,10 +60,12 @@ const postFunc = {
'spotPair/list'
:
spotPairCtrl
.
list
,
'spotPair/pushToCoreSystem'
:
spotPairCtrl
.
pushToCoreSystem
,
'spotPair/getAllSubmitSuccess'
:
spotPairCtrl
.
getAllSubmitSuccess
,
//运营部-其他管理-币种管理
'coinType/save'
:
coinTypeCtrl
.
save
,
'coinType/update'
:
coinTypeCtrl
.
update
,
'coinType/list'
:
coinTypeCtrl
.
list
,
'coinType/pushToCoreSystem'
:
coinTypeCtrl
.
pushToCoreSystem
,
'coinType/getAllSubmitSuccess'
:
coinTypeCtrl
.
getAllSubmitSuccess
,
//权限管理 - 我的权限
'user/getInfo'
:
userOptCtrl
.
getInfo
,
...
...
@@ -107,13 +110,13 @@ const postFunc = {
'user/bind/totp/confirm'
:
userOptCtrl
.
bindTotpConfirm
,
'user/auth/reset/totp'
:
userAuthConfigCtrl
.
resetTotp
,
//运营部-热门交易对搜索
//运营部-
其他管理-
热门交易对搜索
'hot/pair/config/list'
:
hotPairConfigCtrl
.
list
,
'hot/pair/config/add'
:
hotPairConfigCtrl
.
add
,
'hot/pair/config/update'
:
hotPairConfigCtrl
.
update
,
'hot/pair/config/del'
:
hotPairConfigCtrl
.
del
,
//运营部-消息通知
//运营部-
其他管理-
消息通知
'notice/list'
:
noticeCtrl
.
list
,
'notice/add'
:
noticeCtrl
.
add
,
'notice/update'
:
noticeCtrl
.
update
,
...
...
@@ -138,7 +141,7 @@ const postFunc = {
'mUser/manage/order/history/list'
:
orderPendingAndHistoryCtrl
.
historyList
,
//Madex 用户管理 ->历史委托
'mUser/manage/order/detail/list'
:
orderPendingAndHistoryCtrl
.
detailList
,
//Madex 用户管理 ->成交记录
//运营部-资源位管理
//运营部-
现货-
资源位管理
'link/useful/list'
:
usefulLinkCtrl
.
list
,
//链接记录列表
'link/useful/add'
:
usefulLinkCtrl
.
add
,
//添加链接记录
'link/useful/delete'
:
usefulLinkCtrl
.
del
,
//删除链接记录
...
...
@@ -154,7 +157,7 @@ const postFunc = {
'mUser/subscribe/mail/detail'
:
mUserSubscribeCtrl
.
mailDetail
,
//发送详情
'mUser/subscribe/mail/send/group'
:
mUserSubscribeCtrl
.
maiSendGroup
,
//群发邮件
//运营部-费率管理-普通用户手续费
//运营部-
现货-
费率管理-普通用户手续费
'mUser/fee/setting/list'
:
commonUserFeeSettingCtrl
.
list
,
//普通用户手续费列表
'mUser/fee/setting/add'
:
commonUserFeeSettingCtrl
.
add
,
//新增普通用户手续费
'mUser/fee/setting/update'
:
commonUserFeeSettingCtrl
.
update
,
//修改普通用户手续费
...
...
@@ -207,6 +210,15 @@ const postFunc = {
//金融部-其他管理-合约限制交易配置
'fiance/other/contract/limit/trade/set'
:
contractLimitTradeCtrl
.
set
,
'fiance/other/contract/limit/trade/list'
:
contractLimitTradeCtrl
.
list
,
//金融部-其他管理-合约接单账户配置(代理商)
'fiance/other/contract/agent/set'
:
contractAgentCtrl
.
agentSet
,
'fiance/other/contract/agent/list'
:
contractAgentCtrl
.
agentList
,
//金融部-其他管理-合约接单账户关联(代理用户)
'fiance/other/contract/agent/user/set'
:
contractAgentCtrl
.
agentUserSet
,
'fiance/other/contract/agent/user/list'
:
contractAgentCtrl
.
agentUserList
,
//金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set'
:
contractAgentCtrl
.
agentChannelSet
,
'fiance/other/contract/agent/channel/list'
:
contractAgentCtrl
.
agentChannelList
,
};
// TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。
...
...
src/setting/access-limit.ts
View file @
4f294b97
...
...
@@ -8,7 +8,7 @@ const {
let
cmdWhiteList
=
{
//技术部-国际化管理
//技术部-
其他管理-
国际化管理
'i18n/info/list'
:
1
,
'i18n/info/add'
:
1
,
'i18n/info/update'
:
1
,
...
...
@@ -21,10 +21,12 @@ let cmdWhiteList = {
'spotPair/list'
:
1
,
'spotPair/pushToCoreSystem'
:
1
,
'spotPair/getAllSubmitSuccess'
:
1
,
//运营部-其他管理-币种管理
'coinType/save'
:
1
,
'coinType/update'
:
1
,
'coinType/list'
:
1
,
'coinType/pushToCoreSystem'
:
1
,
'coinType/getAllSubmitSuccess'
:
1
,
//权限管理 - 我的权限
'user/getInfo'
:
1
,
...
...
@@ -67,12 +69,12 @@ let cmdWhiteList = {
'user/bind/totp/confirm'
:
1
,
'user/auth/reset/totp'
:
1
,
//运营部-热门交易对搜索
//运营部-
其他管理-
热门交易对搜索
'hot/pair/config/list'
:
1
,
'hot/pair/config/add'
:
1
,
'hot/pair/config/update'
:
1
,
'hot/pair/config/del'
:
1
,
//运营部-消息通知
//运营部-
其他管理-
消息通知
'notice/list'
:
1
,
'notice/add'
:
1
,
'notice/update'
:
1
,
...
...
@@ -94,7 +96,7 @@ let cmdWhiteList = {
'mUser/manage/order/pending/list'
:
1
,
'mUser/manage/order/history/list'
:
1
,
'mUser/manage/order/detail/list'
:
1
,
//运营部-资源位管理
//运营部-
现货-
资源位管理
'link/useful/list'
:
1
,
'link/useful/add'
:
1
,
'link/useful/delete'
:
1
,
...
...
@@ -108,7 +110,7 @@ let cmdWhiteList = {
'mUser/subscribe/mail/send'
:
1
,
'mUser/subscribe/mail/detail'
:
1
,
'mUser/subscribe/mail/send/group'
:
1
,
//运营部-费率管理-普通用户手续费
//运营部-
现货-
费率管理-普通用户手续费
'mUser/fee/setting/list'
:
1
,
'mUser/fee/setting/add'
:
1
,
'mUser/fee/setting/update'
:
1
,
...
...
@@ -160,6 +162,15 @@ let cmdWhiteList = {
//金融部-其他管理-合约限制交易配置
'fiance/other/contract/limit/trade/set'
:
1
,
'fiance/other/contract/limit/trade/list'
:
1
,
//金融部-其他管理-合约接单账户配置(代理商)
'fiance/other/contract/agent/set'
:
1
,
'fiance/other/contract/agent/list'
:
1
,
//金融部-其他管理-合约接单账户关联(代理用户)
'fiance/other/contract/agent/user/set'
:
1
,
'fiance/other/contract/agent/user/list'
:
1
,
//金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set'
:
1
,
'fiance/other/contract/agent/channel/list'
:
1
,
};
...
...
src/setting/login-filter.ts
View file @
4f294b97
...
...
@@ -16,6 +16,7 @@ const ExcludeApi = {
"user/login/confirm"
:
1
,
"mUser/fee/vip/level/list"
:
1
,
"spotPair/getAllSubmitSuccess"
:
1
,
"coinType/getAllSubmitSuccess"
:
1
,
'acl/role/getAll'
:
1
,
'position/allList'
:
1
,
'department/allList'
:
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