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
55654328
Commit
55654328
authored
Oct 08, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加接口、逻辑调整
parent
55eb492a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
250 additions
and
3 deletions
+250
-3
errorCode.ts
src/constant/errorCode.ts
+1
-0
cronApply.ts
src/functional/mvc/control/cronApply.ts
+107
-0
commonUserFeeSetting.service.ts
src/functional/mvc/service/commonUserFeeSetting.service.ts
+2
-2
cronApply.service.ts
src/functional/mvc/service/cronApply.service.ts
+125
-0
index.ts
src/functional/router/v1/index.ts
+9
-0
access-limit.ts
src/setting/access-limit.ts
+6
-1
No files found.
src/constant/errorCode.ts
View file @
55654328
...
@@ -72,4 +72,5 @@ export const ErrorCode = {
...
@@ -72,4 +72,5 @@ export const ErrorCode = {
CURRENT_COIN_DATA_NOT_EXIST
:
'30068'
,
//币种管理中计价币种不存在
CURRENT_COIN_DATA_NOT_EXIST
:
'30068'
,
//币种管理中计价币种不存在
PAIR_EXIST
:
'30069'
,
//交易对对已存在
PAIR_EXIST
:
'30069'
,
//交易对对已存在
ACTIVE_TM_EXPIRE
:
'30070'
,
//交易时间过短
ACTIVE_TM_EXPIRE
:
'30070'
,
//交易时间过短
NO_TRIGGER_DEL
:
'30071'
,
//只有未触发的任务可以删除
}
}
src/functional/mvc/control/cronApply.ts
0 → 100644
View file @
55654328
import
*
as
cronApplyService
from
"../service/cronApply.service"
;
import
{
CronApplyPageVO
,
CronApplyVO
}
from
"../service/cronApply.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
:
CronApplyPageVO
)
=>
{
let
func_name
=
"cronApply.control.list"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
cronApplyService
.
list
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-删除审核上币定时器
* @param req
* @param authConfigVO
*/
export
const
del
=
async
(
req
:
any
,
cronApplyVO
:
CronApplyVO
)
=>
{
let
func_name
=
"cronApply.control.del"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
cronApplyVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
let
res
=
await
cronApplyService
.
del
(
cronApplyVO
.
id
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-增加新币充值定时器
* @param req
* @param authConfigVO
*/
export
const
addDeposit
=
async
(
req
:
any
,
cronApplyVO
:
CronApplyVO
)
=>
{
let
func_name
=
"cronApply.control.addDeposit"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
cronApplyVO
.
trigger_symbol
||
!
cronApplyVO
.
trigger_time
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
tm
=
datetimeUtils
.
add
(
new
Date
(),
datetimeUtils
.
SECONED
*
5
);
if
(
datetimeUtils
.
between
(
cronApplyVO
.
trigger_time
,
tm
)
<
0
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
let
res
=
await
cronApplyService
.
addDeposit
(
cronApplyVO
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 技术部-交易上下线管理-增加新币提现定时器
* @param req
* @param authConfigVO
*/
export
const
addWithdraw
=
async
(
req
:
any
,
cronApplyVO
:
CronApplyVO
)
=>
{
let
func_name
=
"cronApply.control.addWithdraw"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUser
=
await
getCurrentUser
(
req
.
cookies
.
session_id
);
if
(
!
cronApplyVO
.
trigger_symbol
||
!
cronApplyVO
.
trigger_time
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
tm
=
datetimeUtils
.
add
(
new
Date
(),
datetimeUtils
.
SECONED
*
5
);
if
(
datetimeUtils
.
between
(
cronApplyVO
.
trigger_time
,
tm
)
<
0
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
let
res
=
await
cronApplyService
.
addWithdraw
(
cronApplyVO
,
currentUser
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
src/functional/mvc/service/commonUserFeeSetting.service.ts
View file @
55654328
...
@@ -325,7 +325,7 @@ export async function submit(id: number, currentUserId: any, ip: string | undefi
...
@@ -325,7 +325,7 @@ export async function submit(id: number, currentUserId: any, ip: string | undefi
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
//币本位
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
//币本位
if
(
pair
.
toLowerCase
()
==
"all"
)
{
if
(
pair
.
toLowerCase
()
==
"all"
)
{
//TODO:币本位币对查询 enable = 1 的
//TODO:币本位币对查询 enable = 1 的
pairList = 数据库查询结果
let
pairList
=
[];
let
pairList
=
[];
let
insertList
:
any
=
[];
let
insertList
:
any
=
[];
let
ids
:
any
=
[];
let
ids
:
any
=
[];
...
@@ -351,7 +351,7 @@ export async function submit(id: number, currentUserId: any, ip: string | undefi
...
@@ -351,7 +351,7 @@ export async function submit(id: number, currentUserId: any, ip: string | undefi
}
}
else
{
//U本位
else
{
//U本位
if
(
pair
.
toLowerCase
()
==
"all"
)
{
if
(
pair
.
toLowerCase
()
==
"all"
)
{
//TODO:U本位币对查询 enable = 1 的
//TODO:U本位币对查询 enable = 1 的
pairList = 数据库查询结果
let
pairList
=
[];
let
pairList
=
[];
let
insertList
:
any
=
[];
let
insertList
:
any
=
[];
let
ids
:
any
=
[];
let
ids
:
any
=
[];
...
...
src/functional/mvc/service/cronApply.service.ts
0 → 100644
View file @
55654328
import
{
exPairApply
,
coinType
,
ormDB
,
systemTrigger
,
spotPairs
,
exTradeArea
,
exBusinessAreaRouter
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
}
from
"./userOptLog.service"
;
import
{
addCoin2Core
,
addPairToCore
}
from
"../../../utils/coreSystemUtils"
;
import
{
PAIR_APPLY_STATUS
}
from
"../../../constant/pairApplyConst"
;
let
_
=
require
(
'lodash'
);
let
{
logger
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
export
interface
CronApplyVO
{
id
?:
number
;
trigger_symbol
?:
string
;
trigger_type
?:
number
;
trigger_action
?:
number
;
trigger_time
?:
Date
|
any
;
status
?:
number
;
createdAt
?:
Date
|
any
,
updatedAt
?:
Date
|
any
,
}
export
interface
CronApplyPageVO
extends
CronApplyVO
{
page
?:
number
,
size
?:
number
,
}
export
async
function
list
(
pageVO
:
CronApplyPageVO
)
{
let
resList
=
await
systemTrigger
.
prototype
.
findAndCount
({
limit
:
pageVO
.
size
,
offset
:
(
Number
(
pageVO
.
page
)
-
1
)
*
Number
(
pageVO
.
size
),
order
:
[[
"id"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
del
(
id
:
number
,
currentUser
:
any
,
ip
:
string
|
undefined
)
{
let
dbInfo
=
await
systemTrigger
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
if
(
dbInfo
&&
dbInfo
.
status
!=
0
)
{
throw
ErrorCode
.
NO_TRIGGER_DEL
}
await
systemTrigger
.
prototype
.
destroy
({
where
:
{
id
:
id
}
});
//管理后台操作日志
addOptLog
(
currentUser
.
userId
,
0
,
'删除审核上币定时器'
,
ip
,
JSON
.
stringify
(
dbInfo
),
'交易上下线管理'
);
return
'success'
;
}
export
async
function
addDeposit
(
cronApplyVO
:
CronApplyVO
,
currentUser
:
any
,
ip
:
any
)
{
let
dbCoin
=
await
coinType
.
prototype
.
findOne
({
where
:{
symbol
:
cronApplyVO
.
trigger_symbol
},
raw
:
true
});
if
(
!
dbCoin
){
throw
ErrorCode
.
COIN_DATA_NOT_EXIST
}
cronApplyVO
.
trigger_type
=
1
;
cronApplyVO
.
trigger_action
=
1021
;
cronApplyVO
.
status
=
0
;
cronApplyVO
.
createdAt
=
new
Date
();
cronApplyVO
.
updatedAt
=
new
Date
();
await
systemTrigger
.
prototype
.
create
(
cronApplyVO
);
//管理后台操作日志
addOptLog
(
currentUser
.
userId
,
0
,
'增加新币充值定时器'
,
ip
,
JSON
.
stringify
(
cronApplyVO
),
'交易上下线管理'
);
return
'success'
;
}
export
async
function
addWithdraw
(
cronApplyVO
:
CronApplyVO
,
currentUser
:
any
,
ip
:
any
)
{
let
dbCoin
=
await
coinType
.
prototype
.
findOne
({
where
:{
symbol
:
cronApplyVO
.
trigger_symbol
},
raw
:
true
});
if
(
!
dbCoin
){
throw
ErrorCode
.
COIN_DATA_NOT_EXIST
}
cronApplyVO
.
trigger_type
=
1
;
cronApplyVO
.
trigger_action
=
1031
;
cronApplyVO
.
status
=
0
;
cronApplyVO
.
createdAt
=
new
Date
();
cronApplyVO
.
updatedAt
=
new
Date
();
await
systemTrigger
.
prototype
.
create
(
cronApplyVO
);
//管理后台操作日志
addOptLog
(
currentUser
.
userId
,
0
,
'增加新币提现定时器'
,
ip
,
JSON
.
stringify
(
cronApplyVO
),
'交易上下线管理'
);
return
'success'
;
}
src/functional/router/v1/index.ts
View file @
55654328
...
@@ -44,6 +44,7 @@ import * as contractAgentCtrl from "../../mvc/control/contractAgent.control";
...
@@ -44,6 +44,7 @@ import * as contractAgentCtrl from "../../mvc/control/contractAgent.control";
import
*
as
depositAndWithdrawCtrl
from
"../../mvc/control/depositAndWithdraw.control"
;
import
*
as
depositAndWithdrawCtrl
from
"../../mvc/control/depositAndWithdraw.control"
;
import
*
as
coinTypeApplyCtrl
from
"../../mvc/control/coinTypeApply"
;
import
*
as
coinTypeApplyCtrl
from
"../../mvc/control/coinTypeApply"
;
import
*
as
pairApplyCtrl
from
"../../mvc/control/pairApply"
;
import
*
as
pairApplyCtrl
from
"../../mvc/control/pairApply"
;
import
*
as
cronApplyCtrl
from
"../../mvc/control/cronApply"
;
const
getFunc
=
{
const
getFunc
=
{
'user/info'
:
userController
.
getUserInfo
,
'user/info'
:
userController
.
getUserInfo
,
...
@@ -247,6 +248,14 @@ const postFunc = {
...
@@ -247,6 +248,14 @@ const postFunc = {
'tech/apply/new/pair/apply/cancel'
:
pairApplyCtrl
.
cancel
,
//管理员取消申请上新交易对
'tech/apply/new/pair/apply/cancel'
:
pairApplyCtrl
.
cancel
,
//管理员取消申请上新交易对
'tech/apply/new/pair/trade/area/list'
:
pairApplyCtrl
.
tradeAreaList
,
//已有交易区列表
'tech/apply/new/pair/trade/area/list'
:
pairApplyCtrl
.
tradeAreaList
,
//已有交易区列表
'tech/apply/new/pair/listed'
:
pairApplyCtrl
.
listed
,
//已有交易对列表
'tech/apply/new/pair/listed'
:
pairApplyCtrl
.
listed
,
//已有交易对列表
//技术部-交易上下线管理-申请审核定时器
'tech/apply/new/cron/list'
:
cronApplyCtrl
.
list
,
//审核上币定时器信息列表
'tech/apply/new/cron/delete'
:
cronApplyCtrl
.
del
,
//删除审核上币定时器
//'tech/apply/new/cron/pair/add/active': cronApplyCtrl.addActive,//TODO:增加激活交易对定时器 原来有 is_active is_hide 的逻辑 现在spot_pairs 没有相关字段 ???
//'tech/apply/new/cron/pair/add/hide': cronApplyCtrl.addHide,//TODO:增加隐藏交易对定时器 原来有 is_active is_hide 的逻辑 现在spot_pairs 没有相关字段 ???
'tech/apply/new/cron/coin/add/deposit'
:
cronApplyCtrl
.
addDeposit
,
//增加新币充值定时器
'tech/apply/new/cron/coin/add/withdraw'
:
cronApplyCtrl
.
addWithdraw
,
//增加新币提现定时器
};
};
// TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。
// TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。
...
...
src/setting/access-limit.ts
View file @
55654328
...
@@ -189,13 +189,18 @@ let cmdWhiteList = {
...
@@ -189,13 +189,18 @@ let cmdWhiteList = {
//技术部-交易上下线管理-申请上新交易对
//技术部-交易上下线管理-申请上新交易对
'tech/apply/new/pair/list'
:
1
,
'tech/apply/new/pair/list'
:
1
,
'tech/apply/new/pair/apply'
:
1
,
'tech/apply/new/pair/apply'
:
1
,
'tech/apply/new/pair/apply/cancel/self'
:
1
,
'tech/apply/new/pair/apply/cancel/self'
:
1
,
'tech/apply/new/pair/apply/edit'
:
1
,
'tech/apply/new/pair/apply/edit'
:
1
,
'tech/apply/new/pair/apply/review'
:
1
,
'tech/apply/new/pair/apply/review'
:
1
,
'tech/apply/new/pair/apply/rewrite'
:
1
,
'tech/apply/new/pair/apply/rewrite'
:
1
,
'tech/apply/new/pair/apply/cancel'
:
1
,
'tech/apply/new/pair/apply/cancel'
:
1
,
'tech/apply/new/pair/trade/area/list'
:
1
,
'tech/apply/new/pair/trade/area/list'
:
1
,
'tech/apply/new/pair/listed'
:
1
,
'tech/apply/new/pair/listed'
:
1
,
//技术部-交易上下线管理-申请审核定时器
'tech/apply/new/cron/list'
:
1
,
'tech/apply/new/cron/delete'
:
1
,
'tech/apply/new/cron/coin/add/deposit'
:
1
,
'tech/apply/new/cron/coin/add/withdraw'
:
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