Commit 6a689f20 authored by 1486327116's avatar 1486327116

添加代理相关接口

parent 1f405d7e
...@@ -31,16 +31,16 @@ export const agentList = async (req: any, pageVO: AgentPageVO) => { ...@@ -31,16 +31,16 @@ export const agentList = async (req: any, pageVO: AgentPageVO) => {
* @param req * @param req
* @param authConfigVO * @param authConfigVO
*/ */
export const agentSet = async (req: any, agentVO: AgentVO) => { export const agentSet = async (req: any, vo: AgentUserVO) => {
let func_name = "contractAgent.control.agentSet"; let func_name = "contractAgent.control.agentSet";
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 ( !agentVO.user_id) { if ( !vo.user_id) {
throw ErrorCode.PARAM_MISS 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); return Res3Utils.result(res);
} }
catch (e) { catch (e) {
...@@ -123,7 +123,7 @@ export const agentUserSet = async (req: any, agentUserVO: AgentUserVO) => { ...@@ -123,7 +123,7 @@ export const agentUserSet = async (req: any, agentUserVO: AgentUserVO) => {
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 (!agentUserVO.agent_id || !agentUserVO.user_id) { if (!agentUserVO.user_id) {
throw ErrorCode.PARAM_MISS throw ErrorCode.PARAM_MISS
} }
......
...@@ -76,10 +76,16 @@ export async function agentList(pageVO: AgentPageVO) { ...@@ -76,10 +76,16 @@ export async function agentList(pageVO: AgentPageVO) {
return res; 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({ let exist = await userAgent.prototype.find({
where: { where: {
user_id user_id,agent_id
}, },
raw: true raw: true
}); });
...@@ -88,6 +94,8 @@ export async function agentSet(user_id: any, currentUserId: any, ip: string | un ...@@ -88,6 +94,8 @@ export async function agentSet(user_id: any, currentUserId: any, ip: string | un
}else { }else {
await setAgent(user_id, user_id); await setAgent(user_id, user_id);
} }
}
addOptLog(currentUserId, 0, '合约接单账户配置', ip, user_id, '合约接单账户配置'); addOptLog(currentUserId, 0, '合约接单账户配置', ip, user_id, '合约接单账户配置');
return 'success'; return 'success';
...@@ -143,6 +151,9 @@ export async function agentUserSet(agentUserVO: AgentUserVO, currentUserId: any, ...@@ -143,6 +151,9 @@ export async function agentUserSet(agentUserVO: AgentUserVO, currentUserId: any,
let user_id = agentUserVO.user_id; let user_id = agentUserVO.user_id;
let agent_id = agentUserVO.agent_id; let agent_id = agentUserVO.agent_id;
if (agent_id==0) {
await setAgent(user_id, 0);
}else {
let exist = await userAgent.prototype.find({ let exist = await userAgent.prototype.find({
where: { where: {
user_id, user_id,
...@@ -155,6 +166,7 @@ export async function agentUserSet(agentUserVO: AgentUserVO, currentUserId: any, ...@@ -155,6 +166,7 @@ export async function agentUserSet(agentUserVO: AgentUserVO, currentUserId: any,
}else { }else {
await setAgent(user_id, agent_id); await setAgent(user_id, agent_id);
} }
}
//管理后台操作日志 //管理后台操作日志
addOptLog(currentUserId, 0, '合约接单账户关联配置', ip, JSON.stringify(agentUserVO), '合约接单账户关联'); addOptLog(currentUserId, 0, '合约接单账户关联配置', ip, JSON.stringify(agentUserVO), '合约接单账户关联');
return 'success'; return 'success';
......
...@@ -224,13 +224,13 @@ const postFunc = { ...@@ -224,13 +224,13 @@ const postFunc = {
'fiance/other/contract/limit/trade/set': contractLimitTradeCtrl.set, 'fiance/other/contract/limit/trade/set': contractLimitTradeCtrl.set,
'fiance/other/contract/limit/trade/list': contractLimitTradeCtrl.list, 'fiance/other/contract/limit/trade/list': contractLimitTradeCtrl.list,
//金融部-其他管理-合约接单账户配置(代理商) //金融部-其他管理-合约接单账户配置(代理商)
'fiance/other/contract/agent/set': contractAgentCtrl.agentSet, // 参数只要user_id 'fiance/other/contract/agent/set': contractAgentCtrl.agentSet, // 参数 user_id agent_id agent_id 只能为0(删除代理关系) 或者和user_id同值
'fiance/other/contract/agent/list': contractAgentCtrl.agentList, // 参数支持user_id 或者 agent_id 返回值只有user_id agent_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/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/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/user/list': contractAgentCtrl.agentUserList, // 参数支持user_id 或者 agent_id 返回值只有user_id agent_id 时间
//金融部-其他管理-合约渠道用户管理(代理商渠道) //金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set': contractAgentCtrl.agentChannelSet, 'fiance/other/contract/agent/channel/set': contractAgentCtrl.agentChannelSet,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment