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
9e3c753b
Commit
9e3c753b
authored
Dec 07, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixin 相关
parent
517e8b33
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
1 deletion
+89
-1
errorCode.ts
src/constant/errorCode.ts
+2
-0
coinType.control.ts
src/functional/mvc/control/coinType.control.ts
+31
-0
coinType.service.ts
src/functional/mvc/service/coinType.service.ts
+51
-1
index.ts
src/functional/router/v1/index.ts
+2
-0
access-limit.ts
src/setting/access-limit.ts
+2
-0
login-filter.ts
src/setting/login-filter.ts
+1
-0
No files found.
src/constant/errorCode.ts
View file @
9e3c753b
...
...
@@ -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 @
9e3c753b
...
...
@@ -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/service/coinType.service.ts
View file @
9e3c753b
// @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
);
...
...
@@ -195,4 +201,48 @@ export async function getAllSubmitSuccess() {
raw
:
true
});
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/router/v1/index.ts
View file @
9e3c753b
...
...
@@ -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 @
9e3c753b
...
...
@@ -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 @
9e3c753b
...
...
@@ -21,6 +21,7 @@ const ExcludeApi = {
'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