Commit 518af5e9 authored by ml's avatar ml

Merge branch 'master' of ssh://gitlab.mytoken.org:10022/zhuangke/ts-api-demo

# Conflicts:
#	index.ts
#	package-lock.json
#	package.json
#	src/functional/router/v1/index.ts
parents a9f7fc8b 71c29da5
// 计划任务
\ No newline at end of file
......@@ -15,9 +15,7 @@ logger.use(app);
require('@madex/ex-js-common').expressSetting(app);
// Request frequency limit
const limitList = [
"transfer/transferInList",
"transfer/transferOutList",
"transfer/bills",
];
require("@madex/ex-js-common").frequencyLimiting.cookieLimitForCmd(app, limitList);
......@@ -40,6 +38,14 @@ else {
app.use(apiRouterV1);
app.use('/admin/v1', apiRouterV1);
//启动Server
// app.listen(configSetting.port, function () {
// // logger.info("Wallet Gateway-(bibox_b020_southgatetoheaven) server listening on %d, in %s mode", configSetting.port, app.get("env"));
// // wxUtils.serviceStartSend('bibox_b020_southgatetoheaven');
// });
// 输出进程错误
process.on('uncaughtException', (error) => {
......
This diff is collapsed.
......@@ -39,6 +39,7 @@
"dependencies": {
"@madex/ex-js-common": "git+ssh://git@bitbucket.org:biiigle/ex-js-common.git#master",
"@madex/ex-js-public": "git+ssh://git@bitbucket.org:biiigle/ex-js-public.git#master",
"@madex/ex-ts-dao": "*",
"@madex/ex-ts-dao": "0.0.9",
"@types/errorhandler": "^1.5.3",
"@types/express": "^4.17.21",
......
import * as service from "../service/coinType.service";
import { AddParam, ListParam } from "../service/coinType.service";
let { logger, ResponseUtils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public');
export const list = async (req: any, param: ListParam) => {
let func_name = "coinTypeCtl.list";
let cmd = req.path;
try {
param.page = Optional.opt(param, 'page', 1);
param.size = Optional.opt(param, 'size', 50);
let res = await service.list(param);
return ResponseUtils.success(cmd, res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return ResponseUtils.error(func_name, cmd, e);
}
};
export const add = async (req: any, param: AddParam) => {
let func_name = "coinTypeCtl.add";
let cmd = req.path;
try {
ApiAssert.notNull('3000', param.symbol);
ApiAssert.notNull('3000', param.name);
ApiAssert.notNull('3000', param.general_name);
ApiAssert.isInt('3000', param.is_active);
ApiAssert.isInt('3000', param.is_main);
ApiAssert.isInt('3000', param.original_decimals);
ApiAssert.isInt('3000', param.valid_decimals);
ApiAssert.isInt('3000', param.deposit_confirm_count);
ApiAssert.isInt('3000', param.safe_confirm_count);
let res = await service.add(param);
return ResponseUtils.success(cmd, res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return ResponseUtils.error(func_name, cmd, e);
}
};
import * as service from "../service/spotPair.service";
import { AddParam, ListParam } from "../service/spotPair.service";
let { logger, ResponseUtils, optionalUtils: Optional, apiAssertUtils: ApiAssert } = require('@madex/ex-js-public');
export const list = async (req: any, param: ListParam) => {
let func_name = "spotPairCtl.list";
let cmd = req.path;
try {
param.page = Optional.opt(param, 'page', 1);
param.size = Optional.opt(param, 'size', 50);
let res = await service.list(param);
return ResponseUtils.success(cmd, res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return ResponseUtils.error(func_name, cmd, e);
}
};
export const add = async (req: any, param: AddParam) => {
let func_name = "spotPairCtl.add";
let cmd = req.path;
try {
ApiAssert.notNull('3000', param.base);
ApiAssert.notNull('3000', param.quote);
ApiAssert.notNull('3000', param.symbol);
ApiAssert.notNull('3000', param.name);
ApiAssert.notNull('3000', param.price_scale);
ApiAssert.notNull('3000', param.quantity_scale);
ApiAssert.notNull('3000', param.maker_fee);
ApiAssert.notNull('3000', param.taker_fee);
let res = await service.add(param);
return ResponseUtils.success(cmd, res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return ResponseUtils.error(func_name, cmd, e);
}
};
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import { coinType, ormDB } from "@madex/ex-ts-dao";
export interface ListParam {
symbol: string | any;
page: number;
size: number;
}
export interface AddParam {
symbol: string;
is_active: number;
is_main: number;
name: string;
general_name: string;
chain_type?: string;
original_decimals: number;
valid_decimals: number;
contract?: string;
contract_father?: string;
enable_deposit?: number;
enable_withdraw?: number;
enable_transfer?: number;
withdraw_fee?: number;
withdraw_min?: number;
deposit_min?: number;
deposit_confirm_count: number;
safe_confirm_count: number;
explor_url?: string;
icon_url?: string;
describe_url?: string;
forbid_info?: string;
describe_summary?: string;
total_amount?: number;
supply_amount?: number ;
circulation_rate?: number ;
address_num?: number;
price?: string ;
supply_time?:string ;
deflation_rate?:number ;
comment?: string ;
max_transfer_amount?: number ;
tag: string;
forbid_info_related?: number ;
is_hidden?: number ;
main_status?: number ;
}
export async function list(param: ListParam) {
let where = {};
if (param.symbol) {
where["symbol"] = { [ormDB.Op.like]: `%${param.symbol}%` };
}
let resList = await coinType.prototype.findAndCount({
where: where,
limit: param.size,
offset: (param.page - 1) * param.size,
order: [["id", "desc"]],
raw: true
});
return resList;
}
export const add = async (param: AddParam) => {
await coinType.prototype.create(param);
return 'ok';
};
......@@ -28,7 +28,7 @@ export interface I18nInfoVO {
}
export interface I18nInfoPageVO extends I18nInfoVO {
page?: number,
page?: number;
size?: number
}
......
// @madex/ex-ts-dao 是 ts 的 dao, 代码在 bitbucket/ex-js-dao 的 ts 分支上
import { spotPairs, ormDB } from "@madex/ex-ts-dao";
import { NUMBER } from "sequelize";
export interface ListParam {
symbol: string | any;
page: number;
size: number;
}
export interface AddParam {
base:string;
quote:string;
symbol:string;
name:string;
price_scale:number;
quantity_scale:number;
maker_fee:string;
taker_fee: string;
}
export async function list(param: ListParam) {
let where = {};
if (param.symbol) {
where["symbol"]= { [ormDB.Op.like]: `%${param.symbol}%` };
}
let resList = await spotPairs.prototype.findAndCount({
where: where,
limit: param.size,
offset: (Number(param.page) - 1) * Number(param.size),
order: [["id", "desc"]],
raw: true
});
return resList;
}
export const add = async (param: AddParam) => {
await spotPairs.prototype.create(param);
return 'ok';
};
......@@ -16,6 +16,8 @@ import * as userOptCtrl from "../../mvc/control/userOpt.control";
import * as userAuthConfigCtrl from "../../mvc/control/userAuthConfig.control";
import * as ReqUtils from "../../../utils/req-utils";
import * as spotPairCtrl from "../../mvc/control/spotPair.control";
import * as coinTypeCtrl from "../../mvc/control/coinType.control";
const getFunc = {
'user/info': userController.getUserInfo,
};
......@@ -29,6 +31,12 @@ const postFunc = {
'i18n/info/log/list': i18nLogCtrl.list,
'i18n/info/log/revert': i18nLogCtrl.revert,
'spotpair/add': spotPairCtrl.add,
'spotpair/list': spotPairCtrl.list,
'coinType/add': coinTypeCtrl.add,
'coinType/list': coinTypeCtrl.list,
};
'acl/user/add': aclUserCtrl.add,
'acl/user/list': aclUserCtrl.list,
'acl/user/update': aclUserCtrl.update,
......
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