Commit 1eff4f18 authored by 1486327116's avatar 1486327116

update

parent e83f7228
...@@ -161,13 +161,15 @@ export const save = async (param: AddParam, currentUserId: any, ip: any) => { ...@@ -161,13 +161,15 @@ export const save = async (param: AddParam, currentUserId: any, ip: any) => {
}, },
raw: true raw: true
}); });
if (exist) { if (exist) {
param.is_main = 0; param.is_main = 0;
param.asset_id = 0;
}else {
param.is_main = 1;
param.asset_id = exist.asset_id; param.asset_id = exist.asset_id;
param.main_status = exist.main_status; param.main_status = exist.main_status;
}else {
param.is_main = 1;
param.asset_id = 0;
param.main_status = 0;
} }
await coinType.prototype.create(param); await coinType.prototype.create(param);
//管理后台操作日志 //管理后台操作日志
......
...@@ -272,10 +272,32 @@ export async function review(id: any, currentUser: any, ip: string | undefined) ...@@ -272,10 +272,32 @@ export async function review(id: any, currentUser: any, ip: string | undefined)
if (dbSymbol) { if (dbSymbol) {
throw ErrorCode.COIN_DATA_EXIST; throw ErrorCode.COIN_DATA_EXIST;
} }
let exist = await coinType.prototype.findOne({
where: {
is_main:1,
general_name:dbApply.general_name,
},
raw: true
});
let is_main = 0;
let asset_id = 0;
let main_status = 0;
if (exist) {
is_main = 0; // 同名币
asset_id = exist.asset_id;
main_status = exist.main_status;
}else {
is_main = 1;
asset_id = 0;
main_status = 0;
}
let insertInfo = { let insertInfo = {
symbol: dbApply.symbol, symbol: dbApply.symbol,
is_active: 1, is_active: 1,
is_main: 1, asset_id:asset_id,
is_main: is_main,
main_status:main_status,
name: dbApply.name, name: dbApply.name,
general_name: dbApply.general_name, general_name: dbApply.general_name,
chain_type:dbApply.chain_type, chain_type:dbApply.chain_type,
...@@ -294,10 +316,9 @@ export async function review(id: any, currentUser: any, ip: string | undefined) ...@@ -294,10 +316,9 @@ export async function review(id: any, currentUser: any, ip: string | undefined)
forbid_info: dbApply.forbid_info, forbid_info: dbApply.forbid_info,
enable_deposit: 0, enable_deposit: 0,
enable_withdraw: 0, enable_withdraw: 0,
main_status: 0,
createdAt: new Date(), createdAt: new Date(),
updatedAt: new Date(), updatedAt: new Date(),
} };
await coinType.prototype.create(insertInfo); await coinType.prototype.create(insertInfo);
reason = "币种创建完成"; reason = "币种创建完成";
await updateApply(Number(id), APPLY_STATUS.CREATE_SYMBOL, currentUser.account, reason, dbApply.symbol); await updateApply(Number(id), APPLY_STATUS.CREATE_SYMBOL, currentUser.account, reason, dbApply.symbol);
......
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