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
d7ff4690
Commit
d7ff4690
authored
Dec 19, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
金融部-其他管理-账号管理
parent
ad32dd5b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
262 additions
and
1 deletion
+262
-1
fianceAccount.control.ts
src/functional/mvc/control/fianceAccount.control.ts
+105
-0
fianceAccount.service.ts
src/functional/mvc/service/fianceAccount.service.ts
+145
-0
index.ts
src/functional/router/v1/index.ts
+6
-0
access-limit.ts
src/setting/access-limit.ts
+6
-1
No files found.
src/functional/mvc/control/fianceAccount.control.ts
0 → 100644
View file @
d7ff4690
import
*
as
financeAccountService
from
"../service/fianceAccount.service"
;
import
{
FinanceAccountVO
,
FinanceAccountPageVO
}
from
"../service/fianceAccount.service"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
import
{
coinType
,
contractPairs
,
spotPairs
}
from
"@madex/ex-ts-dao"
;
let
isIp
=
require
(
'is-ip'
);
/**
* 账户列表
* @param req
* @param infoVO
*/
export
const
list
=
async
(
req
:
any
,
pageVO
:
FinanceAccountPageVO
)
=>
{
let
func_name
=
"financeAccount.control.list"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
financeAccountService
.
list
(
pageVO
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 添加新的账户
* @param req
* @param authConfigVO
*/
export
const
add
=
async
(
req
:
any
,
financeAccountVO
:
FinanceAccountVO
)
=>
{
let
func_name
=
"financeAccount.control.add"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
await
paramValid
(
financeAccountVO
);
let
res
=
await
financeAccountService
.
add
(
financeAccountVO
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 修改账户信息
* @param req
* @param authConfigVO
*/
export
const
update
=
async
(
req
:
any
,
financeAccountVO
:
FinanceAccountVO
)
=>
{
let
func_name
=
"financeAccount.control.update"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
financeAccountVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
await
paramValid
(
financeAccountVO
);
let
res
=
await
financeAccountService
.
update
(
financeAccountVO
,
currentUserId
,
ip
);
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
,
financeAccountVO
:
FinanceAccountVO
)
=>
{
let
func_name
=
"financeAccount.control.del"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
financeAccountVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
financeAccountService
.
del
(
financeAccountVO
.
id
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
async
function
paramValid
(
financeAccountVO
:
FinanceAccountVO
)
{
if
(
!
financeAccountVO
.
account
||
!
financeAccountVO
.
init_asset
||
!
financeAccountVO
.
apikey
||
!
financeAccountVO
.
secret
||
!
financeAccountVO
.
secret_pwd
||
!
financeAccountVO
.
platform
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
}
src/functional/mvc/service/fianceAccount.service.ts
0 → 100644
View file @
d7ff4690
import
{
financeMarketAccount
,
ormDB
,
}
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'
);
export
interface
FinanceAccountVO
{
id
?:
number
;
account
?:
string
|
any
;
remark
?:
string
|
any
;
init_asset
?:
number
;
apikey
?:
string
|
any
;
secret
?:
string
|
any
;
secret_pwd
?:
string
|
any
;
platform
?:
number
;
status
?:
number
;
createdAt
?:
Date
|
any
,
updatedAt
?:
Date
|
any
,
}
export
interface
FinanceAccountPageVO
extends
FinanceAccountVO
{
page
?:
number
,
size
?:
number
,
}
export
async
function
list
(
pageVO
:
FinanceAccountPageVO
)
{
let
where
=
{};
let
resList
=
await
financeMarketAccount
.
prototype
.
findAndCount
({
where
:
where
,
limit
:
pageVO
.
size
,
offset
:
(
Number
(
pageVO
.
page
)
-
1
)
*
Number
(
pageVO
.
size
),
order
:
[[
"id"
,
"asc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
add
(
financeAccountVO
:
FinanceAccountVO
,
currentUserId
:
any
,
ip
:
any
)
{
let
dbOne
=
await
financeMarketAccount
.
prototype
.
findOne
({
where
:
{
account
:
financeAccountVO
.
account
},
raw
:
true
});
if
(
dbOne
)
{
throw
ErrorCode
.
DATA_EXIST
;
}
financeAccountVO
.
createdAt
=
new
Date
();
financeAccountVO
.
updatedAt
=
new
Date
();
if
(
!
financeAccountVO
.
status
)
{
//默认可用
financeAccountVO
.
status
=
1
;
}
await
financeMarketAccount
.
prototype
.
create
(
financeAccountVO
);
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'新增账户'
,
ip
,
JSON
.
stringify
(
financeAccountVO
),
'金融部-其他管理'
);
return
'success'
;
}
export
async
function
update
(
financeAccountVO
:
FinanceAccountVO
,
currentUserId
:
any
,
ip
:
any
)
{
let
exist
=
await
financeMarketAccount
.
prototype
.
findOne
({
where
:
{
id
:
financeAccountVO
.
id
},
raw
:
true
});
if
(
!
exist
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
let
dbOne
=
await
financeMarketAccount
.
prototype
.
findOne
({
where
:
{
account
:
financeAccountVO
.
account
,
id
:
{
[
ormDB
.
Op
.
ne
]:
financeAccountVO
.
id
}
},
raw
:
true
});
if
(
dbOne
)
{
throw
ErrorCode
.
DATA_EXIST
;
}
financeAccountVO
.
updatedAt
=
new
Date
();
await
financeMarketAccount
.
prototype
.
update
(
financeAccountVO
,
{
where
:
{
id
:
Number
(
financeAccountVO
.
id
)
}
})
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'修改账户信息'
,
ip
,
JSON
.
stringify
(
financeAccountVO
),
'金融部-其他管理'
);
return
'success'
;
}
export
async
function
del
(
id
:
number
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
exist
=
await
financeMarketAccount
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
exist
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
await
financeMarketAccount
.
prototype
.
destroy
({
where
:
{
id
:
id
}
})
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'删除账户信息'
,
ip
,
`id:
${
id
}
`
,
'金融部-其他管理'
);
return
'success'
;
}
src/functional/router/v1/index.ts
View file @
d7ff4690
...
@@ -52,6 +52,7 @@ import * as spotDataCtrl from "../../mvc/control/spotData.control";
...
@@ -52,6 +52,7 @@ import * as spotDataCtrl from "../../mvc/control/spotData.control";
import
*
as
exBusinessAreaCtrl
from
"../../mvc/control/exBusinessArea.control"
;
import
*
as
exBusinessAreaCtrl
from
"../../mvc/control/exBusinessArea.control"
;
import
*
as
rewardTimePeriodCtrl
from
"../../mvc/control/rewardTimePeriod.control"
;
import
*
as
rewardTimePeriodCtrl
from
"../../mvc/control/rewardTimePeriod.control"
;
import
*
as
collateralCtrl
from
"../../mvc/control/collateral.control"
;
import
*
as
collateralCtrl
from
"../../mvc/control/collateral.control"
;
import
*
as
fianceAccountCtrl
from
"../../mvc/control/fianceAccount.control"
;
const
getFunc
=
{
const
getFunc
=
{
'user/info'
:
userController
.
getUserInfo
,
'user/info'
:
userController
.
getUserInfo
,
...
@@ -304,6 +305,11 @@ const postFunc = {
...
@@ -304,6 +305,11 @@ const postFunc = {
//技术部-其他管理-返佣时间配置
//技术部-其他管理-返佣时间配置
'tech/other/reward/time/period/set'
:
rewardTimePeriodCtrl
.
set
,
'tech/other/reward/time/period/set'
:
rewardTimePeriodCtrl
.
set
,
'tech/other/reward/time/period/get'
:
rewardTimePeriodCtrl
.
get
,
'tech/other/reward/time/period/get'
:
rewardTimePeriodCtrl
.
get
,
//金融部-其他管理-账户管理
'fiance/other/account/list'
:
fianceAccountCtrl
.
list
,
'fiance/other/account/add'
:
fianceAccountCtrl
.
add
,
'fiance/other/account/update'
:
fianceAccountCtrl
.
update
,
'fiance/other/account/del'
:
fianceAccountCtrl
.
del
,
};
};
...
...
src/setting/access-limit.ts
View file @
d7ff4690
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
*
as
ReqUtils
from
"../utils/req-utils"
;
import
*
as
ReqUtils
from
"../utils/req-utils"
;
import
Config
from
"../../config"
;
import
Config
from
"../../config"
;
import
*
as
collateralCtrl
from
"../functional/mvc/control/collateral.control"
;
import
*
as
collateralCtrl
from
"../functional/mvc/control/collateral.control"
;
const
{
const
{
Res3Utils
,
Res3Utils
,
logger
:
Logger
,
logger
:
Logger
,
...
@@ -238,10 +239,14 @@ let cmdWhiteList = {
...
@@ -238,10 +239,14 @@ let cmdWhiteList = {
//技术部-其他管理-返佣时间配置
//技术部-其他管理-返佣时间配置
'tech/other/reward/time/period/set'
:
1
,
'tech/other/reward/time/period/set'
:
1
,
'tech/other/reward/time/period/get'
:
1
,
'tech/other/reward/time/period/get'
:
1
,
//金融部-其他管理-账户管理
'fiance/other/account/list'
:
1
,
'fiance/other/account/add'
:
1
,
'fiance/other/account/update'
:
1
,
'fiance/other/account/del'
:
1
,
};
};
let
filter
=
function
(
app
:
any
)
{
let
filter
=
function
(
app
:
any
)
{
app
.
use
(
function
(
req
,
res
,
next
)
{
app
.
use
(
function
(
req
,
res
,
next
)
{
let
path
=
ReqUtils
.
parsePath
(
req
.
originalUrl
);
let
path
=
ReqUtils
.
parsePath
(
req
.
originalUrl
);
...
...
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