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
92f02e46
Commit
92f02e46
authored
Nov 11, 2024
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VIP 管理用户费率逻辑修改
parent
8d1a7179
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
61 deletions
+47
-61
errorCode.ts
src/constant/errorCode.ts
+6
-5
commonUserFeeSetting.control.ts
src/functional/mvc/control/commonUserFeeSetting.control.ts
+4
-0
commonUserFeeSetting.service.ts
src/functional/mvc/service/commonUserFeeSetting.service.ts
+37
-56
No files found.
src/constant/errorCode.ts
View file @
92f02e46
...
@@ -38,12 +38,12 @@ export const ErrorCode = {
...
@@ -38,12 +38,12 @@ export const ErrorCode = {
UID_ILLEGALITY
:
'30035'
,
//UID不合法
UID_ILLEGALITY
:
'30035'
,
//UID不合法
UID_TOO_MUCH
:
'30036'
,
//UID过多
UID_TOO_MUCH
:
'30036'
,
//UID过多
SPOT_NO_ASSETS
:
'30037'
,
//用户
现货
账户未有资产记录
SPOT_NO_ASSETS
:
'30037'
,
//用户
钱包
账户未有资产记录
U_NO_ASSETS
:
'30038'
,
//用户
U本位合约
账户未有资产记录
U_NO_ASSETS
:
'30038'
,
//用户
统一
账户未有资产记录
COIN_NO_ASSETS
:
'30039'
,
//用户
币本位合约
账户未有资产记录
COIN_NO_ASSETS
:
'30039'
,
//用户
统一
账户未有资产记录
SPOT_FEE_NEED_SET
:
'30040'
,
//
币币
费率需要设置
SPOT_FEE_NEED_SET
:
'30040'
,
//
现货
费率需要设置
CONTRACT_FEE_NEED_SET
:
'30041'
,
//合约费率需要设置
CONTRACT_FEE_NEED_SET
:
'30041'
,
//合约费率需要设置
SON_NOT_ADD_FEE
:
'30042'
,
//子账户不能添加
为市商
SON_NOT_ADD_FEE
:
'30042'
,
//子账户不能添加
费率
LEVEL_NOT_EXIST
:
'30043'
,
//指定等级不存在
LEVEL_NOT_EXIST
:
'30043'
,
//指定等级不存在
ONLY_ONE_FEE
:
'30044'
,
//只能有一条未提交的费率设置
ONLY_ONE_FEE
:
'30044'
,
//只能有一条未提交的费率设置
ONLY_UN_SUBMIT_UPDATE
:
'30045'
,
//只有未提交的记录可以修改
ONLY_UN_SUBMIT_UPDATE
:
'30045'
,
//只有未提交的记录可以修改
...
@@ -76,4 +76,5 @@ export const ErrorCode = {
...
@@ -76,4 +76,5 @@ export const ErrorCode = {
EXIST_ACTIVE_PAIR
:
'30072'
,
//已存在生效或即将生效的该交易对费率配置
EXIST_ACTIVE_PAIR
:
'30072'
,
//已存在生效或即将生效的该交易对费率配置
FEE_EX_OR_DEL
:
'30073'
,
//费率设置已过期或已删除,不可以修改
FEE_EX_OR_DEL
:
'30073'
,
//费率设置已过期或已删除,不可以修改
PAIR_FORMAT_ERR
:
'30074'
,
//交易对格式错误
PAIR_FORMAT_ERR
:
'30074'
,
//交易对格式错误
PAIR_NOT_SUPPORT
:
'30075'
,
//暂不支持此交易对
}
}
src/functional/mvc/control/commonUserFeeSetting.control.ts
View file @
92f02e46
...
@@ -136,6 +136,10 @@ async function addParamValid(commonUserFeeVO: CommonUserFeeVO) {
...
@@ -136,6 +136,10 @@ async function addParamValid(commonUserFeeVO: CommonUserFeeVO) {
if
(
!
userId
||
!
beginTime
||
!
expireTime
||
!
pair
||
!
applicant
||
!
makerFee
||
!
takerFee
)
{
if
(
!
userId
||
!
beginTime
||
!
expireTime
||
!
pair
||
!
applicant
||
!
makerFee
||
!
takerFee
)
{
throw
ErrorCode
.
PARAM_MISS
;
throw
ErrorCode
.
PARAM_MISS
;
}
}
//撮合目前只支持 all 后续支持单个币对 可放开
if
(
pair
!=
'all'
){
throw
ErrorCode
.
PAIR_NOT_SUPPORT
;
}
await
checkMaker
(
commonUserFeeVO
);
await
checkMaker
(
commonUserFeeVO
);
await
paramCheck
(
beginTime
,
expireTime
,
Number
(
type
),
userId
);
await
paramCheck
(
beginTime
,
expireTime
,
Number
(
type
),
userId
);
...
...
src/functional/mvc/service/commonUserFeeSetting.service.ts
View file @
92f02e46
...
@@ -153,32 +153,32 @@ export async function add(commonUserFeeVO: CommonUserFeeVO, currentUserId: any,
...
@@ -153,32 +153,32 @@ export async function add(commonUserFeeVO: CommonUserFeeVO, currentUserId: any,
let
pair
=
dbInfo
.
pair
;
let
pair
=
dbInfo
.
pair
;
let
type
=
dbInfo
.
type
;
let
type
=
dbInfo
.
type
;
let
now
=
new
Date
();
let
now
=
new
Date
();
let
insertDb
List
:
any
=
[]
;
let
insertDb
One
:
any
;
let
rateLog
s
=
await
buildSubmitItems
(
pair
,
dbInfo
,
now
,
dbInfo
.
user_channel
,
type
);
let
rateLog
=
await
buildSubmitItem
(
pair
,
dbInfo
,
now
,
dbInfo
.
user_channel
);
//提交到log表
//提交到log表
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
insertDb
List
=
await
feeRateSpotLog
.
prototype
.
bulkCreate
(
rateLogs
,
{
insertDb
One
=
await
feeRateSpotLog
.
prototype
.
create
(
rateLog
,
{
transaction
:
tx
transaction
:
tx
});
});
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
//币本位
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
//币本位
insertDb
List
=
await
feeRateBaseCoinContractLog
.
prototype
.
bulkCreate
(
rateLogs
,
{
insertDb
One
=
await
feeRateBaseCoinContractLog
.
prototype
.
create
(
rateLog
,
{
transaction
:
tx
transaction
:
tx
});
});
}
}
else
{
//U本位
else
{
//U本位
insertDb
List
=
await
feeRateContractLog
.
prototype
.
bulkCreate
(
rateLogs
,
{
insertDb
One
=
await
feeRateContractLog
.
prototype
.
create
(
rateLog
,
{
transaction
:
tx
transaction
:
tx
});
});
}
}
let
id
s
=
insertDbList
.
map
(
item
=>
item
.
id
)
;
let
id
=
insertDbOne
.
id
;
await
commonUserFeeSetting
.
prototype
.
update
({
await
commonUserFeeSetting
.
prototype
.
update
({
fee_log_ids
:
id
s
.
toString
(),
fee_log_ids
:
id
.
toString
(),
update_time
:
new
Date
()
update_time
:
new
Date
()
},
{
},
{
where
:
{
where
:
{
...
@@ -225,31 +225,31 @@ export async function update(commonUserFeeVO: CommonUserFeeVO, currentUserId: an
...
@@ -225,31 +225,31 @@ export async function update(commonUserFeeVO: CommonUserFeeVO, currentUserId: an
let
tx
;
let
tx
;
try
{
try
{
tx
=
await
ormDB
.
transaction
();
tx
=
await
ormDB
.
transaction
();
let
feeLogId
s
:
any
;
let
feeLogId
:
any
;
//这四项修改需要 重新写入 rate_log
//这四项修改需要 重新写入 rate_log
if
(
commonUserFeeVO
.
maker_fee
!=
dbInfo
.
maker_fee
||
commonUserFeeVO
.
taker_fee
!=
dbInfo
.
taker_fee
if
(
commonUserFeeVO
.
maker_fee
!=
dbInfo
.
maker_fee
||
commonUserFeeVO
.
taker_fee
!=
dbInfo
.
taker_fee
||
commonUserFeeVO
.
begin_time
!=
dbInfo
.
begin_time
||
commonUserFeeVO
.
expire_time
!=
dbInfo
.
expire_time
)
{
||
commonUserFeeVO
.
begin_time
!=
dbInfo
.
begin_time
||
commonUserFeeVO
.
expire_time
!=
dbInfo
.
expire_time
)
{
let
insertDb
List
:
any
;
let
insertDb
One
:
any
;
let
rateLog
s
=
await
buildSubmitItems
(
pair
,
commonUserFeeVO
,
new
Date
(),
Number
(
commonUserFeeVO
.
user_channel
),
type
);
let
rateLog
=
await
buildSubmitItem
(
pair
,
commonUserFeeVO
,
new
Date
(),
Number
(
commonUserFeeVO
.
user_channel
)
);
//提交到log表
//提交到log表
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
insertDb
List
=
await
feeRateSpotLog
.
prototype
.
bulkCreate
(
rateLogs
,
{
insertDb
One
=
await
feeRateSpotLog
.
prototype
.
create
(
rateLog
,
{
transaction
:
tx
transaction
:
tx
});
});
}
}
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
//币本位
else
if
(
type
==
FEE_TYPE
.
FEE_TYPE_BASE_COIN_CONTRACT
)
{
//币本位
insertDb
List
=
await
feeRateBaseCoinContractLog
.
prototype
.
bulkCreate
(
rateLogs
,
{
insertDb
One
=
await
feeRateBaseCoinContractLog
.
prototype
.
create
(
rateLog
,
{
transaction
:
tx
transaction
:
tx
});
});
}
}
else
{
//U本位
else
{
//U本位
insertDb
List
=
await
feeRateContractLog
.
prototype
.
bulkCreate
(
rateLogs
,
{
insertDb
One
=
await
feeRateContractLog
.
prototype
.
create
(
rateLog
,
{
transaction
:
tx
transaction
:
tx
});
});
}
}
feeLogId
s
=
insertDbList
.
map
(
item
=>
item
.
id
)
;
feeLogId
=
insertDbOne
.
id
;
}
}
...
@@ -264,7 +264,7 @@ export async function update(commonUserFeeVO: CommonUserFeeVO, currentUserId: an
...
@@ -264,7 +264,7 @@ export async function update(commonUserFeeVO: CommonUserFeeVO, currentUserId: an
amount_require_usdt
:
commonUserFeeVO
.
amount_require_usdt
,
amount_require_usdt
:
commonUserFeeVO
.
amount_require_usdt
,
applicant
:
commonUserFeeVO
.
applicant
,
applicant
:
commonUserFeeVO
.
applicant
,
update_time
:
new
Date
(),
update_time
:
new
Date
(),
fee_log_ids
:
feeLogId
s
?
feeLogIds
.
toString
()
:
dbInfo
.
fee_log_ids
,
fee_log_ids
:
feeLogId
?
feeLogId
.
toString
()
:
dbInfo
.
fee_log_ids
,
},
{
},
{
where
:
{
where
:
{
id
:
Number
(
commonUserFeeVO
.
id
)
id
:
Number
(
commonUserFeeVO
.
id
)
...
@@ -461,51 +461,32 @@ async function getDbFeeSetting(user_id: number | any, type: number | any, user_c
...
@@ -461,51 +461,32 @@ async function getDbFeeSetting(user_id: number | any, type: number | any, user_c
return
dbInfo
;
return
dbInfo
;
}
}
async
function
buildSubmitItems
(
pair
:
string
,
dbInfo
:
any
,
now
:
Date
,
user_channel
:
number
,
type
:
number
)
{
async
function
buildSubmitItem
(
pair
:
string
,
dbInfo
:
any
,
now
:
Date
,
user_channel
:
number
)
{
let
item
=
{
let
pairList
:
any
;
user_id
:
dbInfo
.
user_id
,
if
(
pair
==
'all'
)
{
pair
:
pair
,
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
fee_model
:
FEE_MODEL_SPOT_DEFAULT
,
pairList
=
await
getAllSpotPairs
();
maker_fee
:
dbInfo
.
maker_fee
,
}
taker_fee
:
dbInfo
.
taker_fee
,
else
{
beginAt
:
dbInfo
.
begin_time
,
//TODO:币本位和U本位的交易对怎么区分?
expireAt
:
dbInfo
.
expire_time
,
pairList
=
await
getAllContractPairs
();
is_check
:
FEE_RATE_LOG_STATUS
.
CHECK_STATUS_UNCHECK
,
}
comment
:
""
,
createdAt
:
now
,
updatedAt
:
now
}
}
else
{
//项目方
pairList
=
[
pair
]
if
(
user_channel
==
2
)
{
item
.
comment
=
COMMENT_MAKER_FEE_SUBMIT
}
}
let
itemList
:
any
=
[];
else
if
(
user_channel
==
3
)
{
for
(
let
onePair
of
pairList
)
{
item
.
comment
=
COMMENT_KOL_FEE_SUBMIT
let
item
=
{
}
user_id
:
dbInfo
.
user_id
,
else
{
pair
:
onePair
,
item
.
comment
=
COMMENT_USER_FEE_SUBMIT
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
:
""
,
createdAt
:
now
,
updatedAt
:
now
}
//项目方
if
(
user_channel
==
2
)
{
item
.
comment
=
COMMENT_MAKER_FEE_SUBMIT
}
else
if
(
user_channel
==
3
)
{
item
.
comment
=
COMMENT_KOL_FEE_SUBMIT
}
else
{
item
.
comment
=
COMMENT_USER_FEE_SUBMIT
}
itemList
.
push
(
item
);
}
}
return
item
;
return
itemList
;
}
}
async
function
checkSpotPair
(
pair
:
string
)
{
async
function
checkSpotPair
(
pair
:
string
)
{
...
...
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