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
e4a5d77f
Commit
e4a5d77f
authored
Jan 09, 2025
by
ml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新管理后台-部分接口逻辑调整、项目方交易量统计定时任务
parent
b66ba41a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
126 additions
and
325 deletions
+126
-325
task.fee.rate.log.model.ts
cron/model/task.fee.rate.log.model.ts
+12
-9
task.market.maker.statis.service.ts
cron/service/task.market.maker.statis.service.ts
+88
-292
task_fee_rate_base_coin_contract_log.ts
cron/task/task_fee_rate_base_coin_contract_log.ts
+1
-1
task_fee_rate_contract_log.ts
cron/task/task_fee_rate_contract_log.ts
+1
-1
task_fee_rate_spot_log.ts
cron/task/task_fee_rate_spot_log.ts
+1
-1
task_market_maker_statis.ts
cron/task/task_market_maker_statis.ts
+2
-2
commonUserFeeSetting.control.ts
src/functional/mvc/control/commonUserFeeSetting.control.ts
+10
-6
commonUserFeeSetting.service.ts
src/functional/mvc/service/commonUserFeeSetting.service.ts
+10
-12
mUserRealName.service.ts
src/functional/mvc/service/mUserRealName.service.ts
+1
-1
No files found.
cron/model/task.fee.rate.log.model.ts
View file @
e4a5d77f
...
@@ -121,10 +121,10 @@ export const changeUserSpotFee = async function (user_id, symbol, fee_model, mak
...
@@ -121,10 +121,10 @@ export const changeUserSpotFee = async function (user_id, symbol, fee_model, mak
let
product_type
=
symbol
==
'all'
?
'spot'
:
'single'
;
let
product_type
=
symbol
==
'all'
?
'spot'
:
'single'
;
let
opt_market
=
product_type
;
let
opt_market
=
product_type
;
//生效的费率 与要设置的费率 比对做校验 现在分不开 现货 合约 先不校验 之后分开了 再校验
//生效的费率 与要设置的费率 比对做校验 现在分不开 现货 合约 先不校验 之后分开了 再校验
let
feeExist
=
await
cancelIfFeeExist
(
user_id
,
product_type
,
symbol
,
maker_fee
,
taker_fee
);
let
feeExist
=
await
cancelIfFeeExist
(
user_id
,
product_type
,
symbol
,
maker_fee
,
taker_fee
);
if
(
feeExist
)
{
if
(
feeExist
)
{
return
is_success
;
return
is_success
;
}
}
let
asset
=
await
mainUserAsset
.
prototype
.
findOne
({
let
asset
=
await
mainUserAsset
.
prototype
.
findOne
({
where
:
{
where
:
{
user_id
user_id
...
@@ -148,9 +148,10 @@ export const changeUserSpotFee = async function (user_id, symbol, fee_model, mak
...
@@ -148,9 +148,10 @@ export const changeUserSpotFee = async function (user_id, symbol, fee_model, mak
await
checkUser
(
user_id
);
await
checkUser
(
user_id
);
await
sleep
(
1000
);
await
sleep
(
1000
);
//请求撮合 修改费率
//请求撮合 修改费率 maker_fee 和 taker_fee 同时为1 代表初始化费率
let
tmp_maker_fee
=
Number
(
maker_fee
)
==
0.001
?
1
:
maker_fee
;
let
res
=
await
changeTradingFee
(
pair
,
user_id
,
maker_fee
,
taker_fee
,
"spot"
,
opt_market
);
let
tmp_taker_fee
=
Number
(
taker_fee
)
==
0.002
?
1
:
taker_fee
;
let
res
=
await
changeTradingFee
(
pair
,
user_id
,
tmp_maker_fee
,
tmp_taker_fee
,
"spot"
,
opt_market
);
return
res
.
is_success
;
return
res
.
is_success
;
};
};
...
@@ -194,8 +195,10 @@ export const changeUserContractFee = async function (user_id, symbol, fee_model,
...
@@ -194,8 +195,10 @@ export const changeUserContractFee = async function (user_id, symbol, fee_model,
await
checkUser
(
user_id
);
await
checkUser
(
user_id
);
await
sleep
(
1000
);
await
sleep
(
1000
);
//请求撮合 修改费率
//请求撮合 修改费率 maker_fee 和 taker_fee 同时为1 代表初始化费率
let
res
=
await
changeTradingFee
(
pair
,
user_id
,
maker_fee
,
taker_fee
,
"lpc"
,
opt_market
);
let
tmp_maker_fee
=
Number
(
maker_fee
)
==
0.0004
?
1
:
maker_fee
;
let
tmp_taker_fee
=
Number
(
taker_fee
)
==
0.0006
?
1
:
taker_fee
;
let
res
=
await
changeTradingFee
(
pair
,
user_id
,
tmp_maker_fee
,
tmp_taker_fee
,
"lpc"
,
opt_market
);
return
res
.
is_success
;
return
res
.
is_success
;
};
};
...
...
cron/service/task.market.maker.statis.service.ts
View file @
e4a5d77f
This diff is collapsed.
Click to expand it.
cron/task/task_fee_rate_base_coin_contract_log.ts
View file @
e4a5d77f
...
@@ -208,7 +208,7 @@ async function setExpiredDefault() {
...
@@ -208,7 +208,7 @@ async function setExpiredDefault() {
},
},
raw
:
true
,
raw
:
true
,
});
});
let
init_maker_rate
=
1
,
init_taker_rate
=
1
;
// maker_fee 和 taker_fee 同时为1 代表初始化
用户费率
let
init_maker_rate
=
0.0004
,
init_taker_rate
=
0.0006
;
// 初始
用户费率
let
newFeeArr
:
any
=
[];
let
newFeeArr
:
any
=
[];
let
beginAt
=
new
Date
();
let
beginAt
=
new
Date
();
...
...
cron/task/task_fee_rate_contract_log.ts
View file @
e4a5d77f
...
@@ -206,7 +206,7 @@ async function setExpiredDefault() {
...
@@ -206,7 +206,7 @@ async function setExpiredDefault() {
unCheckCountObj
[
user_id
]
=
amount
;
unCheckCountObj
[
user_id
]
=
amount
;
}
}
let
init_maker_rate
=
1
,
init_taker_rate
=
1
;
// maker_fee 和 taker_fee 同时为1 代表初始化
用户费率
let
init_maker_rate
=
0.0004
,
init_taker_rate
=
0.0006
;
// 初始
用户费率
let
newFeeArr
:
any
=
[];
let
newFeeArr
:
any
=
[];
let
beginAt
=
new
Date
();
let
beginAt
=
new
Date
();
...
...
cron/task/task_fee_rate_spot_log.ts
View file @
e4a5d77f
...
@@ -231,7 +231,7 @@ async function setExpiredDefault() {
...
@@ -231,7 +231,7 @@ async function setExpiredDefault() {
},
},
raw
:
true
,
raw
:
true
,
});
});
let
init_maker_rate
=
1
,
init_taker_rate
=
1
;
// maker_fee 和 taker_fee 同时为1 代表初始化
用户费率
let
init_maker_rate
=
0.001
,
init_taker_rate
=
0.002
;
// 初始
用户费率
let
activePairs
:
any
=
[
'all'
];
let
activePairs
:
any
=
[
'all'
];
for
(
let
i
=
0
;
i
<
defaultPairFee
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
defaultPairFee
.
length
;
i
++
)
{
let
{
symbol
}
=
defaultPairFee
[
i
];
let
{
symbol
}
=
defaultPairFee
[
i
];
...
...
cron/task/task_market_maker_statis.ts
View file @
e4a5d77f
import
{
statisProjectMakerDeals
}
from
"../service/task.market.maker.statis.service"
;
import
{
statis
tics
ProjectMakerDeals
}
from
"../service/task.market.maker.statis.service"
;
const
schedule
=
require
(
'node-schedule'
);
const
schedule
=
require
(
'node-schedule'
);
const
logger
=
require
(
'@madex/ex-js-public'
).
logger
;
const
logger
=
require
(
'@madex/ex-js-public'
).
logger
;
...
@@ -14,7 +14,7 @@ let setFeeRateJob = schedule.scheduleJob('0 10 0 * * *', async function () {
...
@@ -14,7 +14,7 @@ let setFeeRateJob = schedule.scheduleJob('0 10 0 * * *', async function () {
}
}
inJob
=
true
;
inJob
=
true
;
try
{
try
{
await
statisProjectMakerDeals
();
await
statis
tics
ProjectMakerDeals
();
inJob
=
false
;
inJob
=
false
;
}
catch
(
error
)
{
}
catch
(
error
)
{
inJob
=
false
;
inJob
=
false
;
...
...
src/functional/mvc/control/commonUserFeeSetting.control.ts
View file @
e4a5d77f
...
@@ -65,7 +65,7 @@ export const update = async (req: any, commonUserFeeVO: CommonUserFeeVO) => {
...
@@ -65,7 +65,7 @@ export const update = async (req: any, commonUserFeeVO: CommonUserFeeVO) => {
try
{
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
commonUserFeeVO
.
id
){
if
(
!
commonUserFeeVO
.
id
)
{
throw
ErrorCode
.
PARAM_MISS
;
throw
ErrorCode
.
PARAM_MISS
;
}
}
await
addParamValid
(
commonUserFeeVO
);
await
addParamValid
(
commonUserFeeVO
);
...
@@ -103,7 +103,6 @@ export const del = async (req: any, commonUserFeeVO: CommonUserFeeVO) => {
...
@@ -103,7 +103,6 @@ export const del = async (req: any, commonUserFeeVO: CommonUserFeeVO) => {
};
};
/**
/**
* 用户等级费率列表
* 用户等级费率列表
* @param req
* @param req
...
@@ -141,12 +140,13 @@ async function addParamValid(commonUserFeeVO: CommonUserFeeVO) {
...
@@ -141,12 +140,13 @@ async function addParamValid(commonUserFeeVO: CommonUserFeeVO) {
throw ErrorCode.PAIR_NOT_SUPPORT;
throw ErrorCode.PAIR_NOT_SUPPORT;
}*/
}*/
//校验费率范围
//校验费率范围
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
){
if
(
type
==
FEE_TYPE
.
FEE_TYPE_SPOT
)
{
if
(
Number
(
makerFee
)
<
0.0002
||
Number
(
takerFee
)
<
0.0005
){
if
(
Number
(
makerFee
)
<
0.0002
||
Number
(
takerFee
)
<
0.0005
)
{
throw
ErrorCode
.
FEE_TOO_LOW_OR_HIGH
;
throw
ErrorCode
.
FEE_TOO_LOW_OR_HIGH
;
}
}
}
else
{
}
if
(
Number
(
makerFee
)
<
-
0.00015
||
Number
(
takerFee
)
<
0.00035
){
else
{
if
(
Number
(
makerFee
)
<
-
0.00015
||
Number
(
takerFee
)
<
0.00035
)
{
throw
ErrorCode
.
FEE_TOO_LOW_OR_HIGH
;
throw
ErrorCode
.
FEE_TOO_LOW_OR_HIGH
;
}
}
}
}
...
@@ -232,6 +232,10 @@ async function checkMaker(commonUserFeeVO: CommonUserFeeVO) {
...
@@ -232,6 +232,10 @@ async function checkMaker(commonUserFeeVO: CommonUserFeeVO) {
}
}
//项目方
//项目方
if
(
userChannel
==
2
)
{
if
(
userChannel
==
2
)
{
//项目方只允许现货并且单个交易对
if
(
Number
(
commonUserFeeVO
.
type
)
!=
1
||
commonUserFeeVO
.
pair
==
'all'
)
{
throw
ErrorCode
.
PARAM_MISS
;
}
let
statisPeriod
=
commonUserFeeVO
.
statis_period
;
let
statisPeriod
=
commonUserFeeVO
.
statis_period
;
let
amount_require_usdt
=
commonUserFeeVO
.
amount_require_usdt
;
let
amount_require_usdt
=
commonUserFeeVO
.
amount_require_usdt
;
if
(
!
statisPeriod
||
Number
(
statisPeriod
)
<
0
||
Number
(
statisPeriod
)
>
30
)
{
if
(
!
statisPeriod
||
Number
(
statisPeriod
)
<
0
||
Number
(
statisPeriod
)
>
30
)
{
...
...
src/functional/mvc/service/commonUserFeeSetting.service.ts
View file @
e4a5d77f
...
@@ -98,6 +98,15 @@ export async function list(pageVO: CommonUserFeePageVO) {
...
@@ -98,6 +98,15 @@ export async function list(pageVO: CommonUserFeePageVO) {
where
[
'status'
]
=
pageVO
.
status
;
where
[
'status'
]
=
pageVO
.
status
;
}
}
}
}
if
(
pageVO
.
user_id
)
{
where
[
'user_id'
]
=
pageVO
.
user_id
;
}
if
(
pageVO
.
type
)
{
where
[
'type'
]
=
pageVO
.
type
;
}
if
(
pageVO
.
user_channel
)
{
where
[
'user_channel'
]
=
pageVO
.
user_channel
;
}
if
(
pageVO
.
export
)
{
if
(
pageVO
.
export
)
{
let
resList
=
await
commonUserFeeSetting
.
prototype
.
findAll
({
let
resList
=
await
commonUserFeeSetting
.
prototype
.
findAll
({
...
@@ -107,12 +116,7 @@ export async function list(pageVO: CommonUserFeePageVO) {
...
@@ -107,12 +116,7 @@ export async function list(pageVO: CommonUserFeePageVO) {
});
});
return
resList
;
return
resList
;
}
}
if
(
pageVO
.
user_id
)
{
where
[
'user_id'
]
=
pageVO
.
user_id
;
}
if
(
pageVO
.
type
)
{
where
[
'type'
]
=
pageVO
.
type
;
}
let
resList
=
await
commonUserFeeSetting
.
prototype
.
findAndCount
({
let
resList
=
await
commonUserFeeSetting
.
prototype
.
findAndCount
({
...
@@ -131,8 +135,6 @@ export async function list(pageVO: CommonUserFeePageVO) {
...
@@ -131,8 +135,6 @@ export async function list(pageVO: CommonUserFeePageVO) {
if
(
userChannel
==
2
)
{
if
(
userChannel
==
2
)
{
cacheData
=
await
getProjectMakerTradeStat
(
userId
,
pair
);
cacheData
=
await
getProjectMakerTradeStat
(
userId
,
pair
);
}
}
item
.
avg7
=
cacheData
?
cacheData
.
avg7
:
0
;
item
.
avg15
=
cacheData
?
cacheData
.
avg15
:
0
;
item
.
avgUsdt
=
cacheData
?
cacheData
.
avgUsdt
:
0
;
item
.
avgUsdt
=
cacheData
?
cacheData
.
avgUsdt
:
0
;
}
}
}
}
...
@@ -524,16 +526,12 @@ async function checkContractPair(pair: string) {
...
@@ -524,16 +526,12 @@ async function checkContractPair(pair: string) {
async
function
getProjectMakerTradeStat
(
user_id
:
number
,
pair
:
string
)
{
async
function
getProjectMakerTradeStat
(
user_id
:
number
,
pair
:
string
)
{
let
res
=
{
let
res
=
{
avg7
:
0
,
avg15
:
0
,
avgUsdt
:
0
,
avgUsdt
:
0
,
};
};
let
key
=
user_id
+
"_"
+
pair
+
"_projectMaker_FeeRate"
;
let
key
=
user_id
+
"_"
+
pair
+
"_projectMaker_FeeRate"
;
let
redisData
=
await
RedisClient
.
getSync
(
key
);
let
redisData
=
await
RedisClient
.
getSync
(
key
);
if
(
redisData
)
{
if
(
redisData
)
{
let
obj
=
JSON
.
parse
(
redisData
);
let
obj
=
JSON
.
parse
(
redisData
);
res
.
avg7
=
obj
.
avg7
;
res
.
avg15
=
obj
.
avg15
;
res
.
avgUsdt
=
obj
.
avgUsdt
;
res
.
avgUsdt
=
obj
.
avgUsdt
;
}
}
return
res
;
return
res
;
...
...
src/functional/mvc/service/mUserRealName.service.ts
View file @
e4a5d77f
...
@@ -143,7 +143,7 @@ export async function kycList(queryVO: QueryVO) {
...
@@ -143,7 +143,7 @@ export async function kycList(queryVO: QueryVO) {
}
}
let
resList
=
await
userRealName
.
prototype
.
findAndCount
({
let
resList
=
await
userRealName
.
prototype
.
findAndCount
({
attributes
:
[
'id'
,
'user_id'
,
'status'
,
'createdAt'
],
attributes
:
[
'id'
,
'user_id'
,
'status'
,
'createdAt'
,
'auditor'
],
where
:
where
,
where
:
where
,
limit
:
queryVO
.
size
,
limit
:
queryVO
.
size
,
offset
:
(
Number
(
queryVO
.
page
)
-
1
)
*
Number
(
queryVO
.
size
),
offset
:
(
Number
(
queryVO
.
page
)
-
1
)
*
Number
(
queryVO
.
size
),
...
...
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