Commit fcf4263f authored by ml's avatar ml

增加接口、逻辑调整

parent 0f027491
......@@ -45,6 +45,7 @@ export const list = async (req: any, limitTradeVO: LimitTradeVO) => {
let status = limitTradeVO.status;
let pair = limitTradeVO.pair;
let userId = limitTradeVO.user_id;
let type = limitTradeVO.type;
if (pair) {
list = list.filter(item => item.pair == pair);
......@@ -55,6 +56,9 @@ export const list = async (req: any, limitTradeVO: LimitTradeVO) => {
if (userId || userId === 0) {
list = list.filter(item => item.user_id == userId);
}
if (type) {
list = list.filter(item => item.type == type);
}
return Res3Utils.result(list);
}
catch (e) {
......
import * as depositAndWithdrawService from "../service/depositAndWithdraw.service";
import { QueryVO } from "../service/depositAndWithdraw.service";
let { logger, Res3Utils, optionalUtils: Optional, apiAssertUtils: ApiAssert, datetimeUtils } = require('@madex/ex-js-public');
/**
* 客服部-资金管理-充值列表
* @param req
* @param infoVO
*/
export const depositList = async (req: any, pageVO: QueryVO) => {
let func_name = "depositAndWithdraw.control.depositList";
try {
pageVO.page = Optional.opt(pageVO, 'page', 1);
pageVO.size = Optional.opt(pageVO, 'size', 20);
let res = await depositAndWithdrawService.depositList(pageVO);
return Res3Utils.result(res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
/**
* 客服部-资金管理-提现列表
* @param req
* @param infoVO
*/
export const withdrawList = async (req: any, pageVO: QueryVO) => {
let func_name = "depositAndWithdraw.control.withdrawList";
try {
pageVO.page = Optional.opt(pageVO, 'page', 1);
pageVO.size = Optional.opt(pageVO, 'size', 20);
let res = await depositAndWithdrawService.withdrawList(pageVO);
return Res3Utils.result(res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
import { coinTx, coinWithdraw, ormDB } from "@madex/ex-ts-dao";
import { ErrorCode } from "../../../constant/errorCode";
import { addOptLog } from "./userOptLog.service";
let _ = require('lodash');
let { logger } = require('@madex/ex-js-public');
export interface QueryVO {
page?: number,
size?: number,
status?: number;
condition?: string;
from_time?: Date | any,
to_time?: Date | any,
}
export async function depositList(pageVO: QueryVO) {
let where = {};
if (pageVO.condition) {
let or = {
to: pageVO.condition,
tx_id: pageVO.condition,
coin_symbol: pageVO.condition,
}
if (!isNaN(Number(pageVO.condition))) {
or['user_id'] = Number(pageVO.condition)
}
where[ormDB.Op.or] = or;
}
if (pageVO.status || pageVO.status === 0) {
if (pageVO.status === 1) {
where['status'] = { [ormDB.Op.gt]: 0 }
}
else {
where['status'] = pageVO.status
}
}
if (pageVO.from_time && pageVO.to_time) {
where['createdAt'] = { [ormDB.Op.between]: [pageVO.from_time, pageVO.to_time] }
}
let resList = await coinTx.prototype.findAndCount({
where: where,
limit: pageVO.size,
offset: (Number(pageVO.page) - 1) * Number(pageVO.size),
order: [["createdAt", "desc"]],
raw: true
});
return resList;
}
export async function withdrawList(pageVO: QueryVO) {
let where = {};
if (pageVO.condition) {
let or = {
to_address: pageVO.condition,
tx_id: pageVO.condition,
coin_symbol: pageVO.condition,
}
if (!isNaN(Number(pageVO.condition))) {
or['user_id'] = Number(pageVO.condition)
}
where[ormDB.Op.or] = or
}
if (pageVO.status || pageVO.status === 0) {
if (pageVO.status === -1) {
where['status'] = { [ormDB.Op.lt]: 0 }
}
else {
where['status'] = pageVO.status
}
}
if (pageVO.from_time && pageVO.to_time) {
where['createdAt'] = { [ormDB.Op.between]: [pageVO.from_time, pageVO.to_time] }
}
let resList = await coinWithdraw.prototype.findAndCount({
where: where,
limit: pageVO.size,
offset: (Number(pageVO.page) - 1) * Number(pageVO.size),
order: [["createdAt", "desc"]],
raw: true
});
return resList;
}
......@@ -41,6 +41,7 @@ import * as spotMarketMakerCtrl from "../../mvc/control/spotMarketMaker.control"
import * as contractMarketMakerCtrl from "../../mvc/control/contractMarketMaker.control";
import * as contractLimitTradeCtrl from "../../mvc/control/contractLimitTrade.control";
import * as contractAgentCtrl from "../../mvc/control/contractAgent.control";
import * as depositAndWithdrawCtrl from "../../mvc/control/depositAndWithdraw.control";
const getFunc = {
'user/info': userController.getUserInfo,
......@@ -219,6 +220,10 @@ const postFunc = {
//金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set': contractAgentCtrl.agentChannelSet,
'fiance/other/contract/agent/channel/list': contractAgentCtrl.agentChannelList,
//客服部-资金管理-充值管理
'custom/fund/deposit/record/list': depositAndWithdrawCtrl.depositList,
//客服部-资金管理-提现管理
'custom/fund/withdraw/record/list': depositAndWithdrawCtrl.withdrawList,
};
// TODO 这里先和 nodejs 的注册路由方式保持一样,后面在调整。
......
......@@ -171,6 +171,10 @@ let cmdWhiteList = {
//金融部-其他管理-合约渠道用户管理(代理商渠道)
'fiance/other/contract/agent/channel/set': 1,
'fiance/other/contract/agent/channel/list': 1,
//客服部-资金管理-充值管理
'custom/fund/deposit/record/list': 1,
//客服部-资金管理-提现管理
'custom/fund/withdraw/record/list': 1,
};
......
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