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
6a689f20
Commit
6a689f20
authored
Nov 21, 2024
by
1486327116
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加代理相关接口
parent
1f405d7e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
29 deletions
+41
-29
contractAgent.control.ts
src/functional/mvc/control/contractAgent.control.ts
+4
-4
contractAgent.service.ts
src/functional/mvc/service/contractAgent.service.ts
+32
-20
index.ts
src/functional/router/v1/index.ts
+5
-5
No files found.
src/functional/mvc/control/contractAgent.control.ts
View file @
6a689f20
...
...
@@ -31,16 +31,16 @@ export const agentList = async (req: any, pageVO: AgentPageVO) => {
* @param req
* @param authConfigVO
*/
export
const
agentSet
=
async
(
req
:
any
,
agentVO
:
Agent
VO
)
=>
{
export
const
agentSet
=
async
(
req
:
any
,
vo
:
AgentUser
VO
)
=>
{
let
func_name
=
"contractAgent.control.agentSet"
;
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
agentVO
.
user_id
)
{
if
(
!
vo
.
user_id
)
{
throw
ErrorCode
.
PARAM_MISS
}
let
res
=
await
contractAgentService
.
agentSet
(
agentVO
.
user_id
,
currentUserId
,
ip
);
let
res
=
await
contractAgentService
.
agentSet
(
vo
,
currentUserId
,
ip
);
return
Res3Utils
.
result
(
res
);
}
catch
(
e
)
{
...
...
@@ -123,7 +123,7 @@ export const agentUserSet = async (req: any, agentUserVO: AgentUserVO) => {
try
{
let
ip
=
isIp
(
req
.
ip
)
?
req
.
ip
:
'*.*.*.*'
;
let
currentUserId
=
await
getCurrentUserId
(
req
.
cookies
.
session_id
);
if
(
!
agentUserVO
.
agent_id
||
!
agentUserVO
.
user_id
)
{
if
(
!
agentUserVO
.
user_id
)
{
throw
ErrorCode
.
PARAM_MISS
}
...
...
src/functional/mvc/service/contractAgent.service.ts
View file @
6a689f20
...
...
@@ -76,10 +76,16 @@ export async function agentList(pageVO: AgentPageVO) {
return
res
;
}
export
async
function
agentSet
(
user_id
:
any
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
export
async
function
agentSet
(
agentUserVO
:
AgentUserVO
,
currentUserId
:
any
,
ip
:
string
|
undefined
)
{
let
user_id
=
agentUserVO
.
user_id
;
let
agent_id
=
agentUserVO
.
agent_id
;
if
(
agent_id
==
0
)
{
await
setAgent
(
user_id
,
0
);
}
else
{
// 添加
let
exist
=
await
userAgent
.
prototype
.
find
({
where
:
{
user
_id
user_id
,
agent
_id
},
raw
:
true
});
...
...
@@ -88,6 +94,8 @@ export async function agentSet(user_id: any, currentUserId: any, ip: string | un
}
else
{
await
setAgent
(
user_id
,
user_id
);
}
}
addOptLog
(
currentUserId
,
0
,
'合约接单账户配置'
,
ip
,
user_id
,
'合约接单账户配置'
);
return
'success'
;
...
...
@@ -143,6 +151,9 @@ export async function agentUserSet(agentUserVO: AgentUserVO, currentUserId: any,
let
user_id
=
agentUserVO
.
user_id
;
let
agent_id
=
agentUserVO
.
agent_id
;
if
(
agent_id
==
0
)
{
await
setAgent
(
user_id
,
0
);
}
else
{
let
exist
=
await
userAgent
.
prototype
.
find
({
where
:
{
user_id
,
...
...
@@ -155,6 +166,7 @@ export async function agentUserSet(agentUserVO: AgentUserVO, currentUserId: any,
}
else
{
await
setAgent
(
user_id
,
agent_id
);
}
}
//管理后台操作日志
addOptLog
(
currentUserId
,
0
,
'合约接单账户关联配置'
,
ip
,
JSON
.
stringify
(
agentUserVO
),
'合约接单账户关联'
);
return
'success'
;
...
...
src/functional/router/v1/index.ts
View file @
6a689f20
...
...
@@ -224,13 +224,13 @@ const postFunc = {
'fiance/other/contract/limit/trade/set'
:
contractLimitTradeCtrl
.
set
,
'fiance/other/contract/limit/trade/list'
:
contractLimitTradeCtrl
.
list
,
//金融部-其他管理-合约接单账户配置(代理商)
'fiance/other/contract/agent/set'
:
contractAgentCtrl
.
agentSet
,
// 参数
只要user_id
'fiance/other/contract/agent/list'
:
contractAgentCtrl
.
agentList
,
// 参数支持user_id 或者 agent_id 返回值只有user_id agent_id 时间
'fiance/other/contract/agent/hedgeRatio/set'
:
contractAgentCtrl
.
hedgeRatioSet
,
// 給代理商添加对冲配置参数 agent_id product(合约交易对) ratio对冲比例0-1之间
'fiance/other/contract/agent/hedgeRatio/list'
:
contractAgentCtrl
.
hedgeRatioList
,
// 返回值返回list里面 product交易对 ratio对冲比例 qty 对冲数量
'fiance/other/contract/agent/set'
:
contractAgentCtrl
.
agentSet
,
// 参数
user_id agent_id agent_id 只能为0(删除代理关系) 或者和user_id同值
'fiance/other/contract/agent/list'
:
contractAgentCtrl
.
agentList
,
//
可以传1000 全捞出来
参数支持user_id 或者 agent_id 返回值只有user_id agent_id 时间
'fiance/other/contract/agent/hedgeRatio/set'
:
contractAgentCtrl
.
hedgeRatioSet
,
//
新增
給代理商添加对冲配置参数 agent_id product(合约交易对) ratio对冲比例0-1之间
'fiance/other/contract/agent/hedgeRatio/list'
:
contractAgentCtrl
.
hedgeRatioList
,
//
新增
返回值返回list里面 product交易对 ratio对冲比例 qty 对冲数量
//金融部-其他管理-合约接单账户关联(代理用户)
'fiance/other/contract/agent/user/set'
:
contractAgentCtrl
.
agentUserSet
,
// 参数user_id agent_id
'fiance/other/contract/agent/user/set'
:
contractAgentCtrl
.
agentUserSet
,
// 参数user_id agent_id
agent为0(删除代理关系)
'fiance/other/contract/agent/user/list'
:
contractAgentCtrl
.
agentUserList
,
// 参数支持user_id 或者 agent_id 返回值只有user_id agent_id 时间
//金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set'
:
contractAgentCtrl
.
agentChannelSet
,
...
...
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