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
55eb492a
Commit
55eb492a
authored
Oct 08, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加接口、逻辑调整
parent
a892a03e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
729 additions
and
0 deletions
+729
-0
errorCode.ts
src/constant/errorCode.ts
+3
-0
pairApplyConst.ts
src/constant/pairApplyConst.ts
+11
-0
pairApply.ts
src/functional/mvc/control/pairApply.ts
+225
-0
coinTypeApply.service.ts
src/functional/mvc/service/coinTypeApply.service.ts
+3
-0
pairApply.service.ts
src/functional/mvc/service/pairApply.service.ts
+465
-0
index.ts
src/functional/router/v1/index.ts
+11
-0
access-limit.ts
src/setting/access-limit.ts
+11
-0
No files found.
src/constant/errorCode.ts
View file @
55eb492a
...
...
@@ -69,4 +69,7 @@ export const ErrorCode = {
NO_CANCEL
:
'30065'
,
//审核已通过不允许撤销
DEPOSIT_WITHDRAW_TM_EXPIRE
:
'30066'
,
//开放充值时间/开放提现时间过短
CURRENT_STATUS_NOT_APPLY
:
'30067'
,
//当前状态不可以审核
CURRENT_COIN_DATA_NOT_EXIST
:
'30068'
,
//币种管理中计价币种不存在
PAIR_EXIST
:
'30069'
,
//交易对对已存在
ACTIVE_TM_EXPIRE
:
'30070'
,
//交易时间过短
}
src/constant/pairApplyConst.ts
0 → 100644
View file @
55eb492a
export
const
PAIR_APPLY_STATUS
=
{
RE_WRITE
:
1
,
// 被驳回
WAIT_VIEW
:
2
,
// 申请待审批
PASS
:
3
,
// 审批通过
CREATE_PAIR
:
4
,
// 交易对创建完成
ADMIN_ADD_PAIR
:
5
,
// 交易对增加到撮合完成
WAIT_ADMIN_RESTART
:
6
,
// 等待撮合系统重启
ADMIN_ISSUE_PAIR
:
7
,
// 发布交易对到撮合完成
TIMER_ACTIVE
:
8
,
// 交易对激活定时器完成
CANCEL
:
9
,
// 取消
}
\ No newline at end of file
src/functional/mvc/control/pairApply.ts
0 → 100644
View file @
55eb492a
import
*
as
pairApplyService
from
"../service/pairApply.service"
;
import
{
PairApplyVO
,
PairApplyPageVO
}
from
"../service/pairApply.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
getCurrentUser
,
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
let
isIp
=
require
(
'is-ip'
);
/**
* 技术部-交易上下线管理-申请上新交易对列表
* @param req
* @param infoVO
*/
export
const
list
=
async
(
req
:
any
,
pageVO
:
PairApplyPageVO
)
=>
{
let
func_name
=
"pairApply.control.list"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
pairApplyService
.
list
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* TODO:现在查询的是spot_pairs 原来是ex_pair 后期是否需要调整?
* 技术部-交易上下线管理-已有交易对列表
* @param req
* @param infoVO
*/
export
const
listed
=
async
(
req
:
any
,
pageVO
:
PairApplyPageVO
)
=>
{
let
func_name
=
"pairApply.control.listed"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
pairApplyService
.
listed
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-已有交易区列表
* @param req
* @param infoVO
*/
export
const
tradeAreaList
=
async
(
req
:
any
,
pageVO
:
PairApplyPageVO
)
=>
{
let
func_name
=
"pairApply.control.tradeAreaList"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
pairApplyService
.
tradeAreaList
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-申请上新交易对
* @param req
* @param authConfigVO
*/
export
const
apply
=
async
(
req
:
any
,
pairApplyVO
:
PairApplyVO
)
=>
{
let
func_name
=
"pairApply.control.apply"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
await
paramValid
(
pairApplyVO
);
let
res
=
await
pairApplyService
.
apply
(
pairApplyVO
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-编辑上新交易对
* @param req
* @param authConfigVO
*/
export
const
edit
=
async
(
req
:
any
,
pairApplyVO
:
PairApplyVO
)
=>
{
let
func_name
=
"pairApply.control.edit"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
pairApplyVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
await
paramValid
(
pairApplyVO
);
let
res
=
await
pairApplyService
.
edit
(
pairApplyVO
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-撤销申请上新交易对
* @param req
* @param authConfigVO
*/
export
const
cancelSelf
=
async
(
req
:
any
,
pairApplyVO
:
PairApplyVO
)
=>
{
let
func_name
=
"pairApply.control.cancelSelf"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
pairApplyVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
pairApplyService
.
cancelSelf
(
pairApplyVO
.
id
,
pairApplyVO
.
reason
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-驳回申请上新交易对
* @param req
* @param authConfigVO
*/
export
const
rewrite
=
async
(
req
:
any
,
pairApplyVO
:
PairApplyVO
)
=>
{
let
func_name
=
"pairApply.control.rewrite"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
pairApplyVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
pairApplyService
.
rewrite
(
pairApplyVO
.
id
,
pairApplyVO
.
reason
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-管理员取消申请上新新交易对
* @param req
* @param authConfigVO
*/
export
const
cancel
=
async
(
req
:
any
,
pairApplyVO
:
PairApplyVO
)
=>
{
let
func_name
=
"pairApply.control.cancel"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
pairApplyVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
pairApplyService
.
cancel
(
pairApplyVO
.
id
,
pairApplyVO
.
reason
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-审核申请上新新交易对
* @param req
* @param authConfigVO
*/
export
const
review
=
async
(
req
:
any
,
pairApplyVO
:
PairApplyVO
)
=>
{
let
func_name
=
"pairApply.control.review"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
pairApplyVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
pairApplyService
.
review
(
pairApplyVO
.
id
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
async
function
paramValid
(
pairApplyVO
:
PairApplyVO
)
{
if
(
!
pairApplyVO
.
coin_symbol
||
!
pairApplyVO
.
currency_symbol
||
!
pairApplyVO
.
decimal
||
!
pairApplyVO
.
qtyPrecision
||
!
pairApplyVO
.
weight
||
!
pairApplyVO
.
baseMinValue
||
!
pairApplyVO
.
quoteMinValue
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
if
(
!
pairApplyVO
.
pair_type
)
{
pairApplyVO
.
pair_type
=
0
}
if
(
!
pairApplyVO
.
area_id
)
{
pairApplyVO
.
area_id
=
0
}
if
(
!
pairApplyVO
.
business_area_id
)
{
pairApplyVO
.
business_area_id
=
0
}
let
tm
=
datetimeUtils
.
add
(
new
Date
(),
datetimeUtils
.
SECONED
*
10
);
if
(
!
pairApplyVO
.
tm_active
||
datetimeUtils
.
between
(
pairApplyVO
.
tm_active
,
tm
)
<
0
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
}
src/functional/mvc/service/coinTypeApply.service.ts
View file @
55eb492a
...
...
@@ -361,6 +361,9 @@ export async function review(id: any, currentUser: any, ip: string | undefined)
if
(
!
res
.
is_success
)
{
throw
ErrorCode
.
ADD_PAIR_TO_CORE_ERR
;
}
await
coinType
.
prototype
.
update
({
main_status
:
1
},
{
where
:
{
id
:
dbSymbol
.
id
}
});
reason
=
"增加币种到撮合完成"
;
await
updateApply
(
Number
(
id
),
APPLY_STATUS
.
TO_ADMIN
,
currentUser
.
account
,
reason
,
dbApply
.
symbol
);
}
...
...
src/functional/mvc/service/pairApply.service.ts
0 → 100644
View file @
55eb492a
This diff is collapsed.
Click to expand it.
src/functional/router/v1/index.ts
View file @
55eb492a
...
...
@@ -43,6 +43,7 @@ import * as contractLimitTradeCtrl from "../../mvc/control/contractLimitTrade.co
import
*
as
contractAgentCtrl
from
"../../mvc/control/contractAgent.control"
;
import
*
as
depositAndWithdrawCtrl
from
"../../mvc/control/depositAndWithdraw.control"
;
import
*
as
coinTypeApplyCtrl
from
"../../mvc/control/coinTypeApply"
;
import
*
as
pairApplyCtrl
from
"../../mvc/control/pairApply"
;
const
getFunc
=
{
'user/info'
:
userController
.
getUserInfo
,
...
...
@@ -236,6 +237,16 @@ const postFunc = {
'tech/apply/new/coin/apply/cancel'
:
coinTypeApplyCtrl
.
cancel
,
//管理员取消申请上新币
'tech/apply/new/coin/explore/url/list'
:
coinTypeApplyCtrl
.
exploreUrlList
,
//交易浏览器列表
'tech/apply/new/coin/listed'
:
coinTypeApplyCtrl
.
listed
,
//已有币种列表
//技术部-交易上下线管理-申请上新交易对
'tech/apply/new/pair/list'
:
pairApplyCtrl
.
list
,
//申请上交易对列表
'tech/apply/new/pair/apply'
:
pairApplyCtrl
.
apply
,
//申请上新交易对
'tech/apply/new/pair/apply/cancel/self'
:
pairApplyCtrl
.
cancelSelf
,
//撤销申请上新交易对
'tech/apply/new/pair/apply/edit'
:
pairApplyCtrl
.
edit
,
//编辑申请上新交易对
'tech/apply/new/pair/apply/review'
:
pairApplyCtrl
.
review
,
//审核申请上新交易对
'tech/apply/new/pair/apply/rewrite'
:
pairApplyCtrl
.
rewrite
,
//驳回申请上新交易对
'tech/apply/new/pair/apply/cancel'
:
pairApplyCtrl
.
cancel
,
//管理员取消申请上新交易对
'tech/apply/new/pair/trade/area/list'
:
pairApplyCtrl
.
tradeAreaList
,
//已有交易区列表
'tech/apply/new/pair/listed'
:
pairApplyCtrl
.
listed
,
//已有交易对列表
};
// TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。
...
...
src/setting/access-limit.ts
View file @
55eb492a
'use strict'
;
import
*
as
ReqUtils
from
"../utils/req-utils"
;
import
*
as
pairApplyCtrl
from
"../functional/mvc/control/pairApply"
;
const
{
Res3Utils
,
...
...
@@ -185,6 +186,16 @@ let cmdWhiteList = {
'tech/apply/new/coin/apply/cancel'
:
1
,
'tech/apply/new/coin/explore/url/list'
:
1
,
'tech/apply/new/coin/listed'
:
1
,
//技术部-交易上下线管理-申请上新交易对
'tech/apply/new/pair/list'
:
1
,
'tech/apply/new/pair/apply'
:
1
,
'tech/apply/new/pair/apply/cancel/self'
:
1
,
'tech/apply/new/pair/apply/edit'
:
1
,
'tech/apply/new/pair/apply/review'
:
1
,
'tech/apply/new/pair/apply/rewrite'
:
1
,
'tech/apply/new/pair/apply/cancel'
:
1
,
'tech/apply/new/pair/trade/area/list'
:
1
,
'tech/apply/new/pair/listed'
:
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