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
5b87a795
Commit
5b87a795
authored
Dec 18, 2024
by
ml
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
46b677ad
d884eb13
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
1 deletion
+128
-1
collateral.control.ts
src/functional/mvc/control/collateral.control.ts
+50
-0
collateral.service.ts
src/functional/mvc/service/collateral.service.ts
+34
-0
index.ts
src/functional/router/v1/index.ts
+6
-0
access-limit.ts
src/setting/access-limit.ts
+4
-0
coreSystemUtils.ts
src/utils/coreSystemUtils.ts
+34
-1
No files found.
src/functional/mvc/control/collateral.control.ts
0 → 100644
View file @
5b87a795
import
*
as
userOptService
from
"../service/userOpt.service"
;
import
{
AclUserInfoVO
,
AclUserInfoPageVO
}
from
"../service/aclUser.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
getCurrentUser
,
getCurrentUserId
,
}
from
"../../../utils/aclUserUtils"
;
import
*
as
service
from
"../service/collateral.service"
;
import
{
VO
}
from
"../service/collateral.service"
;
let
isIp
=
require
(
'is-ip'
);
export
const
list
=
async
(
req
:
any
)
=>
{
let
func_name
=
"usefulLinkCtrl.list"
;
try
{
let
res
=
await
service
.
list
();
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
export
const
save
=
async
(
req
:
any
,
vo
:
VO
)
=>
{
let
func_name
=
"usefulLinkCtrl.save"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
await
paramValid
(
vo
);
let
res
=
await
service
.
save
(
vo
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
async
function
paramValid
(
vo
:
VO
)
{
if
(
!
vo
.
symbol
||
!
vo
.
discount
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
if
(
vo
.
symbol
==
"USDT"
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
}
src/functional/mvc/service/collateral.service.ts
0 → 100644
View file @
5b87a795
import
{
addOptLog
,
}
from
"./userOptLog.service"
;
import
{
getCollaterals
,
setCollateral
}
from
"../../../utils/coreSystemUtils"
;
let
_
=
require
(
'lodash'
);
let
{
logger
}
=
require
(
'@madex/ex-js-public'
);
export
interface
VO
{
order
?:
number
;
discount
?:
string
|
any
;
symbol
?:
string
|
any
;
collateral
?:
boolean
|
any
;
}
export
async
function
list
()
{
return
await
getCollaterals
();
}
export
async
function
save
(
vo
:
VO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
await
setCollateral
(
vo
.
symbol
,
vo
.
discount
,
vo
.
order
,
vo
.
collateral
);
addOptLog
(
currentUserId
,
0
,
'配置抵扣'
,
ip
,
JSON
.
stringify
(
vo
),
'配置抵扣'
);
return
'success'
}
src/functional/router/v1/index.ts
View file @
5b87a795
...
...
@@ -51,6 +51,7 @@ import * as cronApplyCtrl from "../../mvc/control/cronApply.control";
import
*
as
spotDataCtrl
from
"../../mvc/control/spotData.control"
;
import
*
as
exBusinessAreaCtrl
from
"../../mvc/control/exBusinessArea.control"
;
import
*
as
rewardTimePeriodCtrl
from
"../../mvc/control/rewardTimePeriod.control"
;
import
*
as
collateralCtrl
from
"../../mvc/control/collateral.control"
;
const
getFunc
=
{
'user/info'
:
userController
.
getUserInfo
,
...
...
@@ -243,6 +244,11 @@ const postFunc = {
//金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set'
:
contractAgentCtrl
.
agentChannelSet
,
'fiance/other/contract/agent/channel/list'
:
contractAgentCtrl
.
agentChannelList
,
//金融部-其他管理-币种抵扣
'fiance/other/contract/collateral/list'
:
collateralCtrl
.
list
,
// 列出全部
'fiance/other/contract/collateral/save'
:
collateralCtrl
.
save
,
// 新增或者修改
//客服部-资金管理-充值管理
'custom/fund/deposit/record/list'
:
depositAndWithdrawCtrl
.
depositList
,
//客服部-资金管理-提现管理
...
...
src/setting/access-limit.ts
View file @
5b87a795
'use strict'
;
import
*
as
ReqUtils
from
"../utils/req-utils"
;
import
Config
from
"../../config"
;
import
*
as
collateralCtrl
from
"../functional/mvc/control/collateral.control"
;
const
{
Res3Utils
,
logger
:
Logger
,
...
...
@@ -181,6 +182,9 @@ let cmdWhiteList = {
//金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set'
:
1
,
'fiance/other/contract/agent/channel/list'
:
1
,
//金融部-其他管理-币种抵扣
'fiance/other/contract/collateral/list'
:
1
,
// 列出全部
'fiance/other/contract/collateral/save'
:
1
,
// 新增或者修改
//客服部-资金管理-充值管理
'custom/fund/deposit/record/list'
:
1
,
//客服部-资金管理-提现管理
...
...
src/utils/coreSystemUtils.ts
View file @
5b87a795
...
...
@@ -276,4 +276,37 @@ export const getAgentSettings = async (agent_id) => {
return
null
}
return
data
.
result
;
}
\ No newline at end of file
}
// 获取币种抵扣
export
const
getCollaterals
=
async
()
=>
{
const
url
=
`
${
webadmin_endpoint
}
/asset/collaterals`
let
{
data
}
=
await
axios
.
get
(
url
);
if
(
data
.
state
!=
0
)
{
logger
.
error
(
"getUserDetail"
,
data
.
msg
);
return
null
}
return
data
.
result
;
}
// 设置抵扣
export
const
setCollateral
=
async
(
symbol
,
discount
,
order
,
collateral
=
true
)
=>
{
let
index
=
symbol
+
"_USDT_SWAP"
let
body
=
{
index
,
symbol
,
discount
,
order
,
collateral
};
let
res
=
{
is_success
:
true
,
err_msg
:
""
};
const
url
=
`
${
webadmin_endpoint
}
/asset/set_collateral`
let
{
data
}
=
await
axios
.
post
(
url
,
body
);
if
(
data
.
state
!=
0
)
{
logger
.
error
(
"setCollateral"
,
data
.
msg
);
res
.
is_success
=
false
;
res
.
err_msg
=
data
.
msg
;
}
return
res
;
}
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