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
fef64a78
Commit
fef64a78
authored
Aug 30, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加 普通用户手续费相关接口 调整用户信息接口
parent
ea3f8ff2
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
961 additions
and
18 deletions
+961
-18
package-lock.json
package-lock.json
+10
-10
errorCode.ts
src/constant/errorCode.ts
+14
-0
feeRateLogConst.ts
src/constant/feeRateLogConst.ts
+23
-0
marketMakerConst.ts
src/constant/marketMakerConst.ts
+55
-0
symbolConst.ts
src/constant/symbolConst.ts
+1
-0
commonUserFeeSetting.control.ts
src/functional/mvc/control/commonUserFeeSetting.control.ts
+247
-0
commonUserFeeSetting.service.ts
src/functional/mvc/service/commonUserFeeSetting.service.ts
+483
-0
feeRateBaseCoinContractLog.service.ts
...ctional/mvc/service/feeRateBaseCoinContractLog.service.ts
+25
-0
feeRateContractLog.service.ts
src/functional/mvc/service/feeRateContractLog.service.ts
+29
-0
feeRateSpotLog.service.ts
src/functional/mvc/service/feeRateSpotLog.service.ts
+25
-0
mUserAccountOperateLog.service.ts
src/functional/mvc/service/mUserAccountOperateLog.service.ts
+3
-2
mUserMailLog.service.ts
src/functional/mvc/service/mUserMailLog.service.ts
+2
-1
mUserRealName.service.ts
src/functional/mvc/service/mUserRealName.service.ts
+4
-2
userOpt.service.ts
src/functional/mvc/service/userOpt.service.ts
+8
-1
index.ts
src/functional/router/v1/index.ts
+7
-2
access-limit.ts
src/setting/access-limit.ts
+5
-0
feeRateCheckValidUtils.ts
src/utils/feeRateCheckValidUtils.ts
+20
-0
No files found.
package-lock.json
View file @
fef64a78
...
@@ -875,7 +875,7 @@
...
@@ -875,7 +875,7 @@
},
},
"node_modules/@madex/ex-js-common"
:
{
"node_modules/@madex/ex-js-common"
:
{
"version"
:
"1.0.0"
,
"version"
:
"1.0.0"
,
"resolved"
:
"git+ssh://git@bitbucket.org/biiigle/ex-js-common.git#
a074015198403c5598adea7e0fd4380936a5aa2b
"
,
"resolved"
:
"git+ssh://git@bitbucket.org/biiigle/ex-js-common.git#
8731a80a995567cd1c6e9ecdb256ea9df1e0ff31
"
,
"license"
:
"ISC"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"dependencies"
:
{
"@madex/ex-js-dao"
:
"git+ssh://git@bitbucket.org/biiigle/ex-js-dao.git#master"
,
"@madex/ex-js-dao"
:
"git+ssh://git@bitbucket.org/biiigle/ex-js-dao.git#master"
,
...
@@ -1069,9 +1069,9 @@
...
@@ -1069,9 +1069,9 @@
}
}
},
},
"node_modules/@madex/ex-ts-dao"
:
{
"node_modules/@madex/ex-ts-dao"
:
{
"version"
:
"0.0.2
0
"
,
"version"
:
"0.0.2
1
"
,
"resolved"
:
"https://packages.aliyun.com/646341b481b284e28f47a25b/npm/npm-registry/@madex/ex-ts-dao/-/@madex/ex-ts-dao-0.0.2
0
.tgz"
,
"resolved"
:
"https://packages.aliyun.com/646341b481b284e28f47a25b/npm/npm-registry/@madex/ex-ts-dao/-/@madex/ex-ts-dao-0.0.2
1
.tgz"
,
"integrity"
:
"sha512-
c4TCZnRNc9LfdTh436vTg4DM+dxGeJIpcUo1BjKPijkdL0Ij42BkXOU3iyajViUks7kadVd7VLK9JAeqYDSaUQ
=="
,
"integrity"
:
"sha512-
uXdHq1OyOLxilsj9/k5lavzDvt0HqKOH/oTf3HHSHup2aF/UepUIwm62RyZoDE/MdrdRFS0DZsnddAbAcARRqw
=="
,
"license"
:
"ISC"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"dependencies"
:
{
"@madex/ex-js-public"
:
"git+ssh://git@bitbucket.org/biiigle/ex-js-public.git#master"
,
"@madex/ex-js-public"
:
"git+ssh://git@bitbucket.org/biiigle/ex-js-public.git#master"
,
...
@@ -1617,9 +1617,9 @@
...
@@ -1617,9 +1617,9 @@
}
}
},
},
"node_modules/@types/node"
:
{
"node_modules/@types/node"
:
{
"version"
:
"20.16.
1
"
,
"version"
:
"20.16.
2
"
,
"resolved"
:
"https://packages.aliyun.com/646341b481b284e28f47a25b/npm/npm-registry/@types/node/-/node-20.16.
1
.tgz"
,
"resolved"
:
"https://packages.aliyun.com/646341b481b284e28f47a25b/npm/npm-registry/@types/node/-/node-20.16.
2
.tgz"
,
"integrity"
:
"sha512-
zJDo7wEadFtSyNz5QITDfRcrhqDvQI1xQNQ0VoizPjM/dVAODqqIUWbJPkvsxmTI0MYRGRikcdjMPhOssnPej
Q=="
,
"integrity"
:
"sha512-
91s/n4qUPV/wg8eE9KHYW1kouTfDk2FPGjXbBMfRWP/2vg1rCXNQL1OCabwGs0XSdukuK+MwCDXE30QpSeMUh
Q=="
,
"license"
:
"MIT"
,
"license"
:
"MIT"
,
"dependencies"
:
{
"dependencies"
:
{
"undici-types"
:
"~6.19.2"
"undici-types"
:
"~6.19.2"
...
@@ -2725,9 +2725,9 @@
...
@@ -2725,9 +2725,9 @@
}
}
},
},
"node_modules/aws4"
:
{
"node_modules/aws4"
:
{
"version"
:
"1.13.
1
"
,
"version"
:
"1.13.
2
"
,
"resolved"
:
"https://packages.aliyun.com/646341b481b284e28f47a25b/npm/npm-registry/aws4/-/aws4-1.13.
1
.tgz"
,
"resolved"
:
"https://packages.aliyun.com/646341b481b284e28f47a25b/npm/npm-registry/aws4/-/aws4-1.13.
2
.tgz"
,
"integrity"
:
"sha512-
u5w79Rd7SU4JaIlA/zFqG+gOiuq25q5VLyZ8E+ijJeILuTxVzZgp2CaGw/UTw6pXYN9XMO9yiqj/nEHmhTG5CA
=="
,
"integrity"
:
"sha512-
lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw
=="
,
"license"
:
"MIT"
"license"
:
"MIT"
},
},
"node_modules/axios"
:
{
"node_modules/axios"
:
{
...
...
src/constant/errorCode.ts
View file @
fef64a78
...
@@ -37,4 +37,18 @@ export const ErrorCode = {
...
@@ -37,4 +37,18 @@ export const ErrorCode = {
DATA_STATUS_CHANGED
:
'30034'
,
//非法操作,数据状态已经变更
DATA_STATUS_CHANGED
:
'30034'
,
//非法操作,数据状态已经变更
UID_ILLEGALITY
:
'30035'
,
//UID不合法
UID_ILLEGALITY
:
'30035'
,
//UID不合法
UID_TOO_MUCH
:
'30036'
,
//UID过多
UID_TOO_MUCH
:
'30036'
,
//UID过多
SPOT_NO_ASSETS
:
'30037'
,
//用户现货账户未有资产记录
U_NO_ASSETS
:
'30038'
,
//用户U本位合约账户未有资产记录
COIN_NO_ASSETS
:
'30039'
,
//用户币本位合约账户未有资产记录
SPOT_FEE_NEED_SET
:
'30040'
,
//币币费率需要设置
CONTRACT_FEE_NEED_SET
:
'30041'
,
//合约费率需要设置
SON_NOT_ADD_FEE
:
'30042'
,
//子账户不能添加为市商
LEVEL_NOT_EXIST
:
'30043'
,
//指定等级不存在
ONLY_ONE_FEE
:
'30044'
,
//只能有一条未提交的费率设置
ONLY_UN_SUBMIT_UPDATE
:
'30045'
,
//只有未提交的记录可以修改
UID_TYPE_NOT_UPDATE
:
'30046'
,
//用户ID和类型不能修改
DEL_UN_SUBMIT_ACTIVE
:
'30047'
,
//只能删除未提交或未生效的记录
FEE_USED_NOT_DEL
:
'30048'
,
//费率已生效,不能删除
ONLY_UN_SUBMIT_CAN_SUBMIT
:
'30049'
,
//只有未提交的记录才能提交
}
}
src/constant/feeRateLogConst.ts
0 → 100644
View file @
fef64a78
export
const
FEE_RATE_LOG_STATUS
=
{
/**
* 状态: 未生效。
*/
CHECK_STATUS_UNCHECK
:
0
,
/**
* 状态: 生效中。
*/
CHECK_STATUS_ACTIVE
:
1
,
/**
* 状态: 已删除(未生效时用户主动删除)。
*/
CHECK_STATUS_DELETED
:
2
,
/**
* 状态: 已经生效过,已失效(生效后被新的费率覆盖而失效)。
*/
CHECK_STATUS_ACTIVE_OVER
:
3
,
}
/**
* 币币、合约手续费feeModel字段默认值。
*/
export
const
FEE_MODEL_SPOT_DEFAULT
=
"fixedingain"
\ No newline at end of file
src/constant/marketMakerConst.ts
0 → 100644
View file @
fef64a78
export
const
FEE_TYPE
=
{
/**
* 费率类型: 全部。
*/
FEE_TYPE_ALL
:
0
,
/**
* 费率类型: 币币。
*/
FEE_TYPE_SPOT
:
1
,
/**
* 费率类型: U本位合约。
*/
FEE_TYPE_CONTRACT
:
2
,
/**
* 费率类型: 币本位合约。
*/
FEE_TYPE_BASE_COIN_CONTRACT
:
3
,
/**
* 费率类型: 合约(U本位+币本位)
*/
FEE_TYPE_CONTRACT_ALL
:
5
,
}
export
const
FEE_TYPE_LIST
=
[
FEE_TYPE
.
FEE_TYPE_ALL
,
FEE_TYPE
.
FEE_TYPE_SPOT
,
FEE_TYPE
.
FEE_TYPE_CONTRACT
,
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
,
FEE_TYPE
.
FEE_TYPE_CONTRACT_ALL
,]
export
const
FEE_STATUS
=
{
/**
* 费率设置纪录状态: 未提交。
*/
STATUS_FEE_SETTING_NEW
:
0
,
/**
* 费率设置纪录状态: 已提交。
*/
STATUS_FEE_SETTING_SUBMIT
:
1
,
/**
* 费率设置纪录状态: 已生效。
*/
STATUS_FEE_SETTING_EFFECTED
:
2
,
/**
* 费率设置纪录状态: 已过期。
*/
STATUS_FEE_SETTING_EXPIRE
:
3
,
/**
* 费率设置纪录状态: 已删除。
*/
STATUS_FEE_SETTING_DELETED
:
4
,
}
/**
* 普通用户手续费提交备注。
*/
export
const
COMMENT_USER_FEE_SUBMIT
=
"提交普通用户手续费"
;
\ No newline at end of file
src/constant/symbolConst.ts
0 → 100644
View file @
fef64a78
export
const
SYMBOL_ALL
=
"all"
;
\ No newline at end of file
src/functional/mvc/control/commonUserFeeSetting.control.ts
0 → 100644
View file @
fef64a78
import
*
as
commonUserFeeSettingService
from
"../service/commonUserFeeSetting.service"
;
import
{
CommonUserFeeVO
,
CommonUserFeePageVO
}
from
"../service/commonUserFeeSetting.service"
;
import
{
vipLevelFeeSetting
}
from
"@madex/ex-ts-dao"
;
let
{
logger
,
Res3Utils
,
optionalUtils
:
Optional
,
apiAssertUtils
:
ApiAssert
,
datetimeUtils
}
=
require
(
'@madex/ex-js-public'
);
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
IS_ACTIVE
,
IS_ACTIVE_ARR
,
LINK_TYPE_ARR
}
from
"../../../constant/usefulLinkConst"
;
import
{
getCurrentUserId
}
from
"../../../utils/aclUserUtils"
;
import
{
FEE_TYPE
,
FEE_TYPE_LIST
}
from
"../../../constant/marketMakerConst"
;
import
{
baseCoinCheck
,
baseUCheck
,
spotCheck
}
from
"../../../utils/feeRateCheckValidUtils"
;
import
{
getMUserInfoByUid
}
from
"../../../utils/mUserUtils"
;
import
{
getFatherUserId
}
from
"../service/mUserInfoSon.service"
;
let
isIp
=
require
(
'is-ip'
);
/**
* 手续费列表
* @param req
* @param infoVO
*/
export
const
list
=
async
(
req
:
any
,
pageVO
:
CommonUserFeePageVO
)
=>
{
let
func_name
=
"commonUserFeeSetting.control.list"
;
try
{
pageVO
.
page
=
Optional
.
opt
(
pageVO
,
'page'
,
1
);
pageVO
.
size
=
Optional
.
opt
(
pageVO
,
'size'
,
20
);
let
res
=
await
commonUserFeeSettingService
.
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
,
commonUserFeeVO
:
CommonUserFeeVO
)
=>
{
let
func_name
=
"commonUserFeeSetting.control.add"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
await
addParamValid
(
commonUserFeeVO
);
let
res
=
await
commonUserFeeSettingService
.
add
(
commonUserFeeVO
,
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
,
commonUserFeeVO
:
CommonUserFeeVO
)
=>
{
let
func_name
=
"commonUserFeeSetting.control.update"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
await
updateParamValid
(
commonUserFeeVO
);
let
res
=
await
commonUserFeeSettingService
.
update
(
commonUserFeeVO
,
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
,
commonUserFeeVO
:
CommonUserFeeVO
)
=>
{
let
func_name
=
"commonUserFeeSetting.control.del"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
commonUserFeeVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
commonUserFeeSettingService
.
del
(
commonUserFeeVO
.
id
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
/**
* 提交用户费率
* @param req
* @param authConfigVO
*/
export
const
submit
=
async
(
req
:
any
,
commonUserFeeVO
:
CommonUserFeeVO
)
=>
{
let
func_name
=
"commonUserFeeSetting.control.submit"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
commonUserFeeVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
commonUserFeeSettingService
.
submit
(
commonUserFeeVO
.
id
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
logger
.
error
(
`
${
func_name
}
error:
${
e
}
`
);
return
Res3Utils
.
getErrorResult
(
e
);
}
};
async
function
addParamValid
(
commonUserFeeVO
:
CommonUserFeeVO
)
{
let
userId
=
commonUserFeeVO
.
user_id
;
let
beginTime
=
commonUserFeeVO
.
begin_time
;
let
expireTime
=
commonUserFeeVO
.
expire_time
;
let
type
=
commonUserFeeVO
.
type
;
let
levelId
=
commonUserFeeVO
.
level_id
;
if
(
!
userId
||
!
beginTime
||
!
expireTime
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
await
paramCheck
(
beginTime
,
expireTime
,
Number
(
type
),
userId
);
if
(
levelId
)
{
let
vipLevelSetting
=
await
vipLevelFeeSetting
.
prototype
.
findOne
({
where
:
{
id
:
levelId
},
raw
:
true
});
if
(
!
vipLevelSetting
)
{
throw
ErrorCode
.
LEVEL_NOT_EXIST
;
}
commonUserFeeVO
.
spot_maker_fee
=
vipLevelSetting
.
spot_maker
;
commonUserFeeVO
.
spot_taker_fee
=
vipLevelSetting
.
spot_taker
;
commonUserFeeVO
.
contract_maker_fee
=
vipLevelSetting
.
contract_maker
;
commonUserFeeVO
.
contract_taker_fee
=
vipLevelSetting
.
contract_taker
;
return
;
}
if
((
type
==
FEE_TYPE
.
FEE_TYPE_ALL
||
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
&&
(
!
commonUserFeeVO
.
spot_maker_fee
||
!
commonUserFeeVO
.
spot_taker_fee
))
{
throw
ErrorCode
.
SPOT_FEE_NEED_SET
;
}
if
((
type
==
FEE_TYPE
.
FEE_TYPE_ALL
||
type
==
FEE_TYPE
.
FEE_TYPE_CONTRACT_ALL
||
type
==
FEE_TYPE
.
FEE_TYPE_CONTRACT
||
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
&&
(
!
commonUserFeeVO
.
contract_maker_fee
||
!
commonUserFeeVO
.
contract_taker_fee
))
{
throw
ErrorCode
.
CONTRACT_FEE_NEED_SET
;
}
let
user
=
await
getMUserInfoByUid
(
userId
);
if
(
!
user
||
user
.
deleted_flag
==
1
)
{
throw
ErrorCode
.
USER_NOT_EXIST
;
}
let
fuid
=
await
getFatherUserId
(
userId
);
if
(
fuid
)
{
throw
ErrorCode
.
SON_NOT_ADD_FEE
;
}
}
async
function
updateParamValid
(
commonUserFeeVO
:
CommonUserFeeVO
)
{
let
id
=
commonUserFeeVO
.
id
;
let
userId
=
commonUserFeeVO
.
user_id
;
let
beginTime
=
commonUserFeeVO
.
begin_time
;
let
expireTime
=
commonUserFeeVO
.
expire_time
;
let
type
=
commonUserFeeVO
.
type
;
let
makerFee
=
commonUserFeeVO
.
maker_fee
;
let
takerFee
=
commonUserFeeVO
.
taker_fee
;
if
(
!
id
||
!
userId
||
!
beginTime
||
!
expireTime
||
!
makerFee
||
!
takerFee
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
await
paramCheck
(
beginTime
,
expireTime
,
Number
(
type
),
userId
);
}
/**
* 添加和更新校验入参
* @param beginTime
* @param expireTime
* @param type
* @param userId
*/
async
function
paramCheck
(
beginTime
:
any
,
expireTime
:
any
,
type
:
number
,
userId
:
number
)
{
//结束时间最少需要是一小时后;开始时间和结束时间最少需要间隔一小时
if
(
!
datetimeUtils
.
between
(
expireTime
,
new
Date
())
>
datetimeUtils
.
HOUR
||
!
datetimeUtils
.
between
(
expireTime
,
beginTime
)
>
datetimeUtils
.
HOUR
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
if
(
isNaN
(
Number
(
type
))
||
!
FEE_TYPE_LIST
.
includes
(
Number
(
type
)))
{
throw
ErrorCode
.
PARAM_MISS
;
}
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
if
(
!
await
spotCheck
(
userId
))
{
throw
ErrorCode
.
SPOT_NO_ASSETS
;
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_CONTRACT
)
{
if
(
!
await
baseUCheck
(
userId
))
{
throw
ErrorCode
.
U_NO_ASSETS
;
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
if
(
!
await
baseCoinCheck
(
userId
))
{
throw
ErrorCode
.
COIN_NO_ASSETS
;
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_CONTRACT_ALL
)
{
if
(
!
await
baseUCheck
(
userId
))
{
throw
ErrorCode
.
U_NO_ASSETS
;
}
if
(
!
await
baseCoinCheck
(
userId
))
{
throw
ErrorCode
.
COIN_NO_ASSETS
;
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_ALL
)
{
if
(
!
await
spotCheck
(
userId
))
{
throw
ErrorCode
.
SPOT_NO_ASSETS
;
}
if
(
!
await
baseUCheck
(
userId
))
{
throw
ErrorCode
.
U_NO_ASSETS
;
}
if
(
!
await
baseCoinCheck
(
userId
))
{
throw
ErrorCode
.
COIN_NO_ASSETS
;
}
}
}
src/functional/mvc/service/commonUserFeeSetting.service.ts
0 → 100644
View file @
fef64a78
import
{
ormDB
,
usefulLink
,
commonUserFeeSetting
,
feeRateContractLog
,
feeRateBaseCoinContractLog
,
feeRateSpotLog
}
from
"@madex/ex-ts-dao"
;
import
{
ErrorCode
}
from
"../../../constant/errorCode"
;
import
{
addOptLog
,
LogType
}
from
"./userOptLog.service"
;
import
{
COMMENT_USER_FEE_SUBMIT
,
FEE_STATUS
,
FEE_TYPE
}
from
"../../../constant/marketMakerConst"
;
import
{
SYMBOL_ALL
}
from
"../../../constant/symbolConst"
;
import
*
as
feeRateSpotLogService
from
"./feeRateSpotLog.service"
;
import
*
as
feeRateContractLogService
from
"./feeRateContractLog.service"
;
import
*
as
feeRateBaseCoinContractLogService
from
"./feeRateBaseCoinContractLog.service"
;
import
{
FEE_MODEL_SPOT_DEFAULT
,
FEE_RATE_LOG_STATUS
}
from
"../../../constant/feeRateLogConst"
;
let
_
=
require
(
'lodash'
);
let
{
logger
}
=
require
(
'@madex/ex-js-public'
);
export
interface
CommonUserFeeVO
{
id
?:
number
;
user_id
?:
number
|
any
;
vip_level
?:
number
;
type
?:
number
;
pair
?:
string
;
maker_fee
?:
number
,
taker_fee
?:
number
,
begin_time
?:
Date
|
any
,
expire_time
?:
Date
|
any
,
maker_fee_later
?:
number
,
taker_fee_later
?:
number
,
status
?:
number
,
remark
?:
string
;
fee_log_ids
?:
string
;
create_time
?:
Date
|
any
,
update_time
?:
Date
|
any
,
level_id
?:
number
;
spot_maker_fee
?:
number
;
spot_taker_fee
?:
number
;
contract_maker_fee
?:
number
;
contract_taker_fee
?:
number
;
}
export
interface
CommonUserFeePageVO
extends
CommonUserFeeVO
{
page
?:
number
,
size
?:
number
,
export
?:
number
,
//是不全部数据 1 全部倒出 0 否
}
export
async
function
list
(
pageVO
:
CommonUserFeePageVO
)
{
if
(
pageVO
.
export
)
{
let
resList
=
await
commonUserFeeSetting
.
prototype
.
findAll
({
order
:
[[
'id'
,
'desc'
]],
raw
:
true
});
return
resList
;
}
let
where
=
Object
.
create
(
null
);
if
(
pageVO
.
user_id
)
{
where
.
user_id
=
pageVO
.
user_id
;
}
if
(
pageVO
.
type
)
{
where
.
type
=
pageVO
.
type
;
}
let
resList
=
await
commonUserFeeSetting
.
prototype
.
findAndCount
({
where
:
where
,
limit
:
pageVO
.
size
,
offset
:
(
Number
(
pageVO
.
page
)
-
1
)
*
Number
(
pageVO
.
size
),
order
:
[[
"id"
,
"desc"
]],
raw
:
true
});
return
resList
;
}
export
async
function
add
(
commonUserFeeVO
:
CommonUserFeeVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
insertList
:
any
=
[];
let
{
spotFeeSetting
,
contractFeeSetting
,
baseCoinFeeSetting
}
=
dealData
(
commonUserFeeVO
);
if
(
spotFeeSetting
)
{
let
[
spot
,
all
]
=
await
Promise
.
all
([
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_SPOT
),
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_ALL
)]);
if
(
spot
||
all
)
{
throw
ErrorCode
.
ONLY_ONE_FEE
}
insertList
.
push
(
spotFeeSetting
);
}
if
(
contractFeeSetting
)
{
let
[
contract
,
contractAll
,
all
]
=
await
Promise
.
all
([
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_CONTRACT
),
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_CONTRACT_ALL
),
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_ALL
)]);
if
(
contract
||
contractAll
||
all
)
{
throw
ErrorCode
.
ONLY_ONE_FEE
}
insertList
.
push
(
contractFeeSetting
);
}
if
(
baseCoinFeeSetting
)
{
let
[
contract
,
contractAll
,
all
]
=
await
Promise
.
all
([
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
),
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_CONTRACT_ALL
),
getFeeSetting
(
commonUserFeeVO
.
user_id
,
FEE_TYPE
.
FEE_TYPE_ALL
)]);
if
(
contract
||
contractAll
||
all
)
{
throw
ErrorCode
.
ONLY_ONE_FEE
}
insertList
.
push
(
baseCoinFeeSetting
);
}
await
commonUserFeeSetting
.
prototype
.
bulkCreate
(
insertList
);
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,新增用户手续费:
${
JSON
.
stringify
(
commonUserFeeVO
)}
`
,
LogType
.
ADD
);
}
export
async
function
update
(
commonUserFeeVO
:
CommonUserFeeVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
dbInfo
=
await
commonUserFeeSetting
.
prototype
.
findOne
({
where
:
{
id
:
commonUserFeeVO
.
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
if
(
dbInfo
.
status
!=
FEE_STATUS
.
STATUS_FEE_SETTING_NEW
)
{
throw
ErrorCode
.
ONLY_UN_SUBMIT_UPDATE
}
if
(
dbInfo
.
user_id
!=
commonUserFeeVO
.
user_id
||
dbInfo
.
type
!=
commonUserFeeVO
.
type
)
{
throw
ErrorCode
.
UID_TYPE_NOT_UPDATE
}
await
commonUserFeeSetting
.
prototype
.
update
({
pair
:
commonUserFeeVO
.
pair
,
maker_fee
:
Number
(
commonUserFeeVO
.
maker_fee
),
taker_fee
:
Number
(
commonUserFeeVO
.
taker_fee
),
begin_time
:
commonUserFeeVO
.
begin_time
,
expire_time
:
commonUserFeeVO
.
expire_time
,
remark
:
commonUserFeeVO
.
remark
,
fee_log_ids
:
""
,
update_time
:
new
Date
(),
},
{
where
:
{
id
:
Number
(
commonUserFeeVO
.
id
)
}
})
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,修改用户手续费:
${
JSON
.
stringify
(
commonUserFeeVO
)}
`
,
LogType
.
UPDATE
);
}
export
async
function
del
(
id
:
number
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
dbInfo
=
await
commonUserFeeSetting
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
let
status
=
dbInfo
.
status
;
let
type
=
dbInfo
.
type
;
if
(
status
!=
FEE_STATUS
.
STATUS_FEE_SETTING_NEW
&&
status
!=
FEE_STATUS
.
STATUS_FEE_SETTING_SUBMIT
)
{
throw
ErrorCode
.
DEL_UN_SUBMIT_ACTIVE
}
if
(
status
==
FEE_STATUS
.
STATUS_FEE_SETTING_NEW
)
{
await
commonUserFeeSetting
.
prototype
.
destroy
({
where
:
{
id
:
id
}
});
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,删除用户手续费:
${
JSON
.
stringify
(
id
)}
`
,
LogType
.
DEL
);
return
'success'
}
let
feeLogIdsStr
=
dbInfo
.
fee_log_ids
;
let
feeLogIds
=
feeLogIdsStr
.
split
(
","
);
let
isActive
=
false
;
// 根据费率设置纪录的状态,确定是否有记录被激活。
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
let
dbList
=
await
feeRateSpotLogService
.
getByIdList
(
feeLogIds
);
let
filterList
=
_
.
filter
(
dbList
,
i
=>
i
.
is_check
!=
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
);
if
(
filterList
&&
filterList
.
length
)
{
isActive
=
true
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
let
dbList
=
await
feeRateBaseCoinContractLogService
.
getByIdList
(
feeLogIds
);
let
filterList
=
_
.
filter
(
dbList
,
i
=>
i
.
is_check
!=
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
);
if
(
filterList
&&
filterList
.
length
)
{
isActive
=
true
}
}
else
{
let
dbList
=
await
feeRateContractLogService
.
getByIdList
(
feeLogIds
);
let
filterList
=
_
.
filter
(
dbList
,
i
=>
i
.
is_check
!=
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
);
if
(
filterList
&&
filterList
.
length
)
{
isActive
=
true
}
}
if
(
isActive
)
{
await
commonUserFeeSetting
.
prototype
.
update
({
status
:
FEE_STATUS
.
STATUS_FEE_SETTING_EFFECTED
,
update_time
:
new
Date
()
},
{
where
:
{
id
:
id
,
status
:
status
}
});
throw
ErrorCode
.
FEE_USED_NOT_DEL
}
let
tx
;
try
{
tx
=
await
ormDB
.
transaction
();
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
await
feeRateSpotLogService
.
uncheck2Deleted
(
feeLogIds
,
tx
);
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
await
feeRateBaseCoinContractLogService
.
uncheck2Deleted
(
feeLogIds
,
tx
);
}
else
{
await
feeRateContractLogService
.
uncheck2Deleted
(
feeLogIds
,
tx
);
}
await
commonUserFeeSetting
.
prototype
.
update
({
status
:
FEE_STATUS
.
STATUS_FEE_SETTING_DELETED
,
update_time
:
new
Date
()
},
{
where
:
{
id
:
id
,
status
:
status
},
transaction
:
tx
});
await
tx
.
commit
();
}
catch
(
e
)
{
if
(
tx
)
{
await
tx
.
rollback
();
}
logger
.
error
(
'commonUserFeeSetting.service.del.error:'
+
e
);
throw
e
;
}
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,删除用户手续费:
${
JSON
.
stringify
(
id
)}
`
,
LogType
.
DEL
);
return
'success'
;
}
export
async
function
submit
(
id
:
number
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
dbInfo
=
await
commonUserFeeSetting
.
prototype
.
findOne
({
where
:
{
id
:
id
},
raw
:
true
});
if
(
!
dbInfo
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
}
let
status
=
dbInfo
.
status
;
let
type
=
dbInfo
.
type
;
if
(
status
!=
FEE_STATUS
.
STATUS_FEE_SETTING_NEW
)
{
throw
ErrorCode
.
ONLY_UN_SUBMIT_CAN_SUBMIT
}
let
pair
=
String
(
dbInfo
.
pair
);
let
userId
=
dbInfo
.
user_id
;
let
feeLogId
=
""
;
let
now
=
new
Date
();
let
tx
;
try
{
tx
=
await
ormDB
.
transaction
();
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
let
insertInfo
=
buildSubmitItem
(
pair
,
dbInfo
,
now
);
let
item
=
await
feeRateSpotLog
.
prototype
.
create
(
insertInfo
,
{
transaction
:
tx
});
feeLogId
=
item
.
id
.
toString
();
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
//币本位
if
(
pair
.
toLowerCase
()
==
"all"
)
{
//TODO:币本位币对查询 enable = 1 的
let
pairList
=
[];
let
insertList
:
any
=
[];
let
ids
:
any
=
[];
for
(
let
onePair
of
pairList
)
{
let
oneInsert
=
buildSubmitItem
(
onePair
,
dbInfo
,
now
);
insertList
.
push
(
oneInsert
);
}
let
bulkList
=
await
feeRateBaseCoinContractLog
.
prototype
.
bulkCreate
(
insertList
,
{
transaction
:
tx
});
for
(
let
one
of
bulkList
)
{
ids
.
push
(
one
.
id
);
}
feeLogId
=
ids
.
toString
();
}
else
{
let
one
=
buildSubmitItem
(
pair
,
dbInfo
,
now
);
let
insertOne
=
await
feeRateBaseCoinContractLog
.
prototype
.
create
(
one
,
{
transaction
:
tx
});
feeLogId
=
insertOne
.
id
.
toString
()
}
}
else
{
//U本位
if
(
pair
.
toLowerCase
()
==
"all"
)
{
//TODO:U本位币对查询 enable = 1 的
let
pairList
=
[];
let
insertList
:
any
=
[];
let
ids
:
any
=
[];
for
(
let
onePair
of
pairList
)
{
let
oneInsert
=
buildSubmitItem
(
onePair
,
dbInfo
,
now
);
insertList
.
push
(
oneInsert
);
}
let
bulkList
=
await
feeRateContractLog
.
prototype
.
bulkCreate
(
insertList
,
{
transaction
:
tx
});
for
(
let
one
of
bulkList
)
{
ids
.
push
(
one
.
id
);
}
feeLogId
=
ids
.
toString
();
}
else
{
let
one
=
buildSubmitItem
(
pair
,
dbInfo
,
now
);
let
insertOne
=
await
feeRateContractLog
.
prototype
.
create
(
one
,
{
transaction
:
tx
});
feeLogId
=
insertOne
.
id
.
toString
()
}
}
await
commonUserFeeSetting
.
prototype
.
update
({
status
:
FEE_STATUS
.
STATUS_FEE_SETTING_SUBMIT
,
fee_log_ids
:
feeLogId
,
update_time
:
new
Date
()
},
{
where
:
{
id
:
id
,
status
:
FEE_STATUS
.
STATUS_FEE_SETTING_NEW
},
transaction
:
tx
});
await
tx
.
commit
();
}
catch
(
e
)
{
if
(
tx
)
{
await
tx
.
rollback
();
}
logger
.
error
(
'commonUserFeeSetting.service.submit.error:'
+
e
);
throw
e
;
}
//管理后台操作日志
addOptLog
(
currentUserId
,
`ip:
${
ip
}
,提交用户手续费:
${
JSON
.
stringify
(
id
)}
`
,
LogType
.
ADD
);
return
'success'
}
function
dealData
(
commonUserFeeVO
:
CommonUserFeeVO
)
{
let
spotFeeSetting
,
contractFeeSetting
,
baseCoinFeeSetting
;
let
type
=
commonUserFeeVO
.
type
;
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
spotFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
spot_maker_fee
,
commonUserFeeVO
.
spot_taker_fee
,
FEE_TYPE
.
FEE_TYPE_SPOT
)
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_CONTRACT
)
{
contractFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
contract_maker_fee
,
commonUserFeeVO
.
contract_taker_fee
,
FEE_TYPE
.
FEE_TYPE_CONTRACT
)
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
baseCoinFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
contract_maker_fee
,
commonUserFeeVO
.
contract_taker_fee
,
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_CONTRACT_ALL
)
{
contractFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
contract_maker_fee
,
commonUserFeeVO
.
contract_taker_fee
,
FEE_TYPE
.
FEE_TYPE_CONTRACT
)
baseCoinFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
contract_maker_fee
,
commonUserFeeVO
.
contract_taker_fee
,
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
}
else
{
spotFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
spot_maker_fee
,
commonUserFeeVO
.
spot_taker_fee
,
FEE_TYPE
.
FEE_TYPE_SPOT
)
contractFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
contract_maker_fee
,
commonUserFeeVO
.
contract_taker_fee
,
FEE_TYPE
.
FEE_TYPE_CONTRACT
)
baseCoinFeeSetting
=
buildOne
(
commonUserFeeVO
,
commonUserFeeVO
.
contract_maker_fee
,
commonUserFeeVO
.
contract_taker_fee
,
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
}
return
{
spotFeeSetting
,
contractFeeSetting
,
baseCoinFeeSetting
}
}
function
buildOne
(
commonUserFeeVO
:
CommonUserFeeVO
,
maker_fee
:
number
|
any
,
taker_fee
:
number
|
any
,
type
:
number
|
any
)
{
let
one
=
{
user_id
:
commonUserFeeVO
.
user_id
,
type
:
Number
(
type
),
pair
:
SYMBOL_ALL
,
maker_fee
:
Number
(
maker_fee
),
taker_fee
:
Number
(
taker_fee
),
begin_time
:
commonUserFeeVO
.
begin_time
,
expire_time
:
commonUserFeeVO
.
expire_time
,
remark
:
commonUserFeeVO
.
remark
,
status
:
FEE_STATUS
.
STATUS_FEE_SETTING_NEW
,
fee_log_ids
:
""
,
create_time
:
new
Date
(),
update_time
:
new
Date
(),
}
return
one
;
}
async
function
getFeeSetting
(
user_id
:
number
|
any
,
type
:
number
|
any
)
{
let
dbInfo
=
await
commonUserFeeSetting
.
prototype
.
findOne
({
where
:
{
user_id
:
Number
(
user_id
),
type
:
Number
(
type
),
status
:
FEE_STATUS
.
STATUS_FEE_SETTING_NEW
},
raw
:
true
});
return
dbInfo
;
}
function
buildSubmitItem
(
pair
:
string
,
dbInfo
:
any
,
now
:
Date
)
{
let
item
=
{
user_id
:
dbInfo
.
user_id
,
pair
:
pair
,
fee_model
:
FEE_MODEL_SPOT_DEFAULT
,
maker_fee
:
dbInfo
.
maker_fee
,
taker_fee
:
dbInfo
.
taker_fee
,
beginAt
:
dbInfo
.
begin_time
,
expireAt
:
dbInfo
.
expire_time
,
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
,
comment
:
COMMENT_USER_FEE_SUBMIT
,
createdAt
:
now
,
updatedAt
:
now
}
return
item
;
}
src/functional/mvc/service/feeRateBaseCoinContractLog.service.ts
0 → 100644
View file @
fef64a78
import
{
ormDB
,
feeRateBaseCoinContractLog
}
from
"@madex/ex-ts-dao"
;
import
{
FEE_RATE_LOG_STATUS
}
from
"../../../constant/feeRateLogConst"
;
export
const
getByIdList
=
async
function
(
ids
:
any
)
{
let
list
=
await
feeRateBaseCoinContractLog
.
prototype
.
findAll
({
where
:
{
id
:
{
[
ormDB
.
Op
.
in
]:
ids
}
},
raw
:
true
});
return
list
;
}
export
const
uncheck2Deleted
=
async
function
(
ids
:
any
,
tx
:
any
)
{
await
feeRateBaseCoinContractLog
.
prototype
.
update
({
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_DELETED
},
{
where
:
{
id
:
{
[
ormDB
.
Op
.
in
]:
ids
},
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
},
transaction
:
tx
});
}
\ No newline at end of file
src/functional/mvc/service/feeRateContractLog.service.ts
0 → 100644
View file @
fef64a78
import
{
ormDB
,
feeRateContractLog
}
from
"@madex/ex-ts-dao"
;
import
{
FEE_RATE_LOG_STATUS
}
from
"../../../constant/feeRateLogConst"
;
export
const
getByIdList
=
async
function
(
ids
:
any
)
{
let
list
=
await
feeRateContractLog
.
prototype
.
findAll
({
where
:
{
id
:
{
[
ormDB
.
Op
.
in
]:
ids
}
},
raw
:
true
});
return
list
;
}
/**
* 需要注意在上层处理事务
* @param ids
* @param tx
*/
export
const
uncheck2Deleted
=
async
function
(
ids
:
any
,
tx
:
any
)
{
await
feeRateContractLog
.
prototype
.
update
({
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_DELETED
},
{
where
:
{
id
:
{
[
ormDB
.
Op
.
in
]:
ids
},
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
},
transaction
:
tx
});
}
\ No newline at end of file
src/functional/mvc/service/feeRateSpotLog.service.ts
0 → 100644
View file @
fef64a78
import
{
ormDB
,
feeRateSpotLog
}
from
"@madex/ex-ts-dao"
;
import
{
FEE_RATE_LOG_STATUS
}
from
"../../../constant/feeRateLogConst"
;
export
const
getByIdList
=
async
function
(
ids
:
any
)
{
let
list
=
await
feeRateSpotLog
.
prototype
.
findAll
({
where
:
{
id
:
{
[
ormDB
.
Op
.
in
]:
ids
}
},
raw
:
true
});
return
list
;
}
export
const
uncheck2Deleted
=
async
function
(
ids
:
any
,
tx
:
any
)
{
await
feeRateSpotLog
.
prototype
.
update
({
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_DELETED
},
{
where
:
{
id
:
{
[
ormDB
.
Op
.
in
]:
ids
},
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
},
transaction
:
tx
});
}
\ No newline at end of file
src/functional/mvc/service/mUserAccountOperateLog.service.ts
View file @
fef64a78
...
@@ -28,7 +28,8 @@ export const recordMUserOperateLog = async function (m_user_id: number, operate_
...
@@ -28,7 +28,8 @@ export const recordMUserOperateLog = async function (m_user_id: number, operate_
let
aclUser
=
await
aclUserInfo
.
prototype
.
findOne
({
let
aclUser
=
await
aclUserInfo
.
prototype
.
findOne
({
where
:
{
where
:
{
user_id
:
operate_user_id
user_id
:
operate_user_id
}
},
raw
:
true
});
});
let
operate_user_name
=
aclUser
.
account
?
aclUser
.
account
:
operate_user_id
;
let
operate_user_name
=
aclUser
.
account
?
aclUser
.
account
:
operate_user_id
;
...
...
src/functional/mvc/service/mUserMailLog.service.ts
View file @
fef64a78
...
@@ -83,7 +83,8 @@ export async function mailSend(userMailLogVO: UserMailLogVO, currentUserId: any,
...
@@ -83,7 +83,8 @@ export async function mailSend(userMailLogVO: UserMailLogVO, currentUserId: any,
}
}
let
toAddrRes
=
await
userSub
.
prototype
.
findAll
({
let
toAddrRes
=
await
userSub
.
prototype
.
findAll
({
where
:
where
where
:
where
,
raw
:
true
});
});
if
(
!
toAddrRes
.
length
)
{
if
(
!
toAddrRes
.
length
)
{
throw
ErrorCode
.
DATA_NOT_EXIST
throw
ErrorCode
.
DATA_NOT_EXIST
...
...
src/functional/mvc/service/mUserRealName.service.ts
View file @
fef64a78
...
@@ -101,7 +101,8 @@ export async function kycList(queryVO: QueryVO, isAdmin: boolean) {
...
@@ -101,7 +101,8 @@ export async function kycList(queryVO: QueryVO, isAdmin: boolean) {
attributes
:
[
'user_id'
,
'email'
],
attributes
:
[
'user_id'
,
'email'
],
where
:
{
where
:
{
user_id
:
{
[
ormDB
.
Op
.
in
]:
uids
}
user_id
:
{
[
ormDB
.
Op
.
in
]:
uids
}
}
},
raw
:
true
});
});
for
(
let
dbUserInfo
of
dbUserInfos
)
{
for
(
let
dbUserInfo
of
dbUserInfos
)
{
userMap
[
dbUserInfo
.
user_id
]
=
dbUserInfo
.
email
;
userMap
[
dbUserInfo
.
user_id
]
=
dbUserInfo
.
email
;
...
@@ -136,7 +137,8 @@ export async function oneDetail(id: number) {
...
@@ -136,7 +137,8 @@ export async function oneDetail(id: number) {
attributes
:
[
'user_id'
,
'email'
],
attributes
:
[
'user_id'
,
'email'
],
where
:
{
where
:
{
user_id
:
dbOne
.
user_id
user_id
:
dbOne
.
user_id
}
},
raw
:
true
});
});
dbOne
.
email
=
dbUserInfo
?
dbUserInfo
.
email
:
""
;
dbOne
.
email
=
dbUserInfo
?
dbUserInfo
.
email
:
""
;
...
...
src/functional/mvc/service/userOpt.service.ts
View file @
fef64a78
...
@@ -11,6 +11,7 @@ import { getOneAclUserByAccount, getOneAclUserByUid } from "../../../utils/aclUs
...
@@ -11,6 +11,7 @@ import { getOneAclUserByAccount, getOneAclUserByUid } from "../../../utils/aclUs
import
{
RedisVal
}
from
"../../../constant/redis-val"
;
import
{
RedisVal
}
from
"../../../constant/redis-val"
;
import
Config
from
"../../../../config"
;
import
Config
from
"../../../../config"
;
import
*
as
userOptLogService
from
"./userOptLog.service"
;
import
*
as
userOptLogService
from
"./userOptLog.service"
;
import
{
findByUserId
}
from
"../service/userAuthConfig.service"
;
const
Otplib
=
require
(
'otplib'
);
const
Otplib
=
require
(
'otplib'
);
...
@@ -30,7 +31,8 @@ export const getInfo = async (currentUserId: number | any, sessionId: string) =>
...
@@ -30,7 +31,8 @@ export const getInfo = async (currentUserId: number | any, sessionId: string) =>
ApiAssert
.
isFalse
(
ErrorCode
.
ACCOUNT_STOP
,
dbUserInfo
.
user_status
===
AclUserInfoConst
.
USER_STATUS
.
DEL
);
ApiAssert
.
isFalse
(
ErrorCode
.
ACCOUNT_STOP
,
dbUserInfo
.
user_status
===
AclUserInfoConst
.
USER_STATUS
.
DEL
);
let
{
roleSet
,
authSet
}
=
await
aclRoleAuthService
.
getUserAcl
(
dbUserInfo
.
user_id
);
let
{
roleSet
,
authSet
}
=
await
aclRoleAuthService
.
getUserAcl
(
dbUserInfo
.
user_id
);
//安全项配置
let
authConfigDbInfo
=
await
findByUserId
(
currentUserId
);
let
data
=
{
let
data
=
{
remark
:
dbUserInfo
.
remark
,
remark
:
dbUserInfo
.
remark
,
...
@@ -40,6 +42,11 @@ export const getInfo = async (currentUserId: number | any, sessionId: string) =>
...
@@ -40,6 +42,11 @@ export const getInfo = async (currentUserId: number | any, sessionId: string) =>
sessionId
:
sessionId
,
sessionId
:
sessionId
,
roleSet
:
roleSet
,
roleSet
:
roleSet
,
authSet
:
authSet
,
authSet
:
authSet
,
force
:
authConfigDbInfo
?
authConfigDbInfo
.
force
:
0
,
deadline
:
authConfigDbInfo
?
authConfigDbInfo
.
deadline
:
null
,
hasTotp
:
authConfigDbInfo
&&
authConfigDbInfo
.
totp_encrypt
?
1
:
0
,
isLocked
:
authConfigDbInfo
?
authConfigDbInfo
.
is_locked
:
0
,
lockedTime
:
authConfigDbInfo
?
authConfigDbInfo
.
locked_time
:
null
,
}
}
return
data
return
data
...
...
src/functional/router/v1/index.ts
View file @
fef64a78
...
@@ -25,6 +25,7 @@ import * as mUserManageCtrl from "../../mvc/control/mUserManage.control";
...
@@ -25,6 +25,7 @@ import * as mUserManageCtrl from "../../mvc/control/mUserManage.control";
import
*
as
mUserRealNameCtrl
from
"../../mvc/control/mUserRealName.control"
;
import
*
as
mUserRealNameCtrl
from
"../../mvc/control/mUserRealName.control"
;
import
*
as
usefulLinkCtrl
from
"../../mvc/control/usefulLink.control"
;
import
*
as
usefulLinkCtrl
from
"../../mvc/control/usefulLink.control"
;
import
*
as
mUserSubscribeCtrl
from
"../../mvc/control/mUserSubscribe.control"
;
import
*
as
mUserSubscribeCtrl
from
"../../mvc/control/mUserSubscribe.control"
;
import
*
as
commonUserFeeSettingCtrl
from
"../../mvc/control/commonUserFeeSetting.control"
;
const
getFunc
=
{
const
getFunc
=
{
'user/info'
:
userController
.
getUserInfo
,
'user/info'
:
userController
.
getUserInfo
,
};
};
...
@@ -123,8 +124,12 @@ const postFunc = {
...
@@ -123,8 +124,12 @@ const postFunc = {
'mUser/subscribe/mail/detail'
:
mUserSubscribeCtrl
.
mailDetail
,
//发送详情
'mUser/subscribe/mail/detail'
:
mUserSubscribeCtrl
.
mailDetail
,
//发送详情
'mUser/subscribe/mail/send/group'
:
mUserSubscribeCtrl
.
maiSendGroup
,
//群发邮件
'mUser/subscribe/mail/send/group'
:
mUserSubscribeCtrl
.
maiSendGroup
,
//群发邮件
//普通用户手续费
'mUser/fee/setting/list'
:
commonUserFeeSettingCtrl
.
list
,
//普通用户手续费列表
'mUser/fee/setting/add'
:
commonUserFeeSettingCtrl
.
add
,
//新增普通用户手续费
'mUser/fee/setting/update'
:
commonUserFeeSettingCtrl
.
update
,
//修改普通用户手续费
'mUser/fee/setting/delete'
:
commonUserFeeSettingCtrl
.
del
,
//删除普通用户手续费
'mUser/fee/setting/submit'
:
commonUserFeeSettingCtrl
.
submit
,
//提交普通用户手续费
};
};
...
...
src/setting/access-limit.ts
View file @
fef64a78
...
@@ -77,6 +77,11 @@ let cmdWhiteList = {
...
@@ -77,6 +77,11 @@ let cmdWhiteList = {
'mUser/subscribe/mail/send'
:
1
,
'mUser/subscribe/mail/send'
:
1
,
'mUser/subscribe/mail/detail'
:
1
,
'mUser/subscribe/mail/detail'
:
1
,
'mUser/subscribe/mail/send/group'
:
1
,
'mUser/subscribe/mail/send/group'
:
1
,
'mUser/fee/setting/list'
:
1
,
'mUser/fee/setting/add'
:
1
,
'mUser/fee/setting/update'
:
1
,
'mUser/fee/setting/delete'
:
1
,
'mUser/fee/setting/submit'
:
1
,
};
};
...
...
src/utils/feeRateCheckValidUtils.ts
0 → 100644
View file @
fef64a78
let
blockCoin
=
"BIX0"
;
export
const
spotCheck
=
async
function
(
user_id
:
number
)
{
//TODO:后面补齐查询现货资产逻辑
let
exist
=
{};
return
exist
;
}
export
const
baseCoinCheck
=
async
function
(
user_id
:
number
)
{
//TODO:后面补齐查询币本位资产逻辑
let
exist
=
{};
return
exist
;
}
export
const
baseUCheck
=
async
function
(
user_id
:
number
)
{
//TODO:后面补齐查询U本位资产逻辑
let
exist
=
{};
return
exist
;
}
\ No newline at end of file
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