Commit c95cd950 authored by ml's avatar ml

修改

parent 64503208
......@@ -269,7 +269,7 @@ export async function review(id: any, currentUser: any, ip: string | undefined)
//检查交易对中的币种是否存在于coin_type 中
await checkPairInCoinType(pair);
//检查交易对是否存在
await checkPairExist(pair, type);
await checkPairExistBeforeCreate(pair, type);
let insertInfo = {
symbol: pair,
......@@ -508,3 +508,24 @@ async function checkPairExist(pair: string, type: number) {
return dbPair;
}
async function checkPairExistBeforeCreate(pair: string, type: number) {
let dbPair: any;
//现货
if (type == 1) {
dbPair = await spotPairs.prototype.findOne({
where: { symbol: pair },
raw: true
});
}
else {//合约
dbPair = await contractPairs.prototype.findOne({
where: { symbol: pair },
raw: true
});
}
if (dbPair) {
throw ErrorCode.PAIR_EXIST;
}
return dbPair;
}
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