Commit d2175372 authored by 1486327116's avatar 1486327116

update

parent 4b01948f
...@@ -87,7 +87,7 @@ const syncCoin = async () => { ...@@ -87,7 +87,7 @@ const syncCoin = async () => {
main_status: 2, main_status: 2,
asset_id: cfg["id"], asset_id: cfg["id"],
}, { }, {
where: { id, main_status: 1 } where: { general_name:symbol } // 同名币的一块更新了
}); });
logger.info(symbol, "sync config success") logger.info(symbol, "sync config success")
} }
......
...@@ -21,6 +21,20 @@ export const list = async (req: any, param: ListParam) => { ...@@ -21,6 +21,20 @@ export const list = async (req: any, param: ListParam) => {
} }
}; };
export const chainList = async (req: any, param: ListParam) => {
let func_name = "coinTypeCtl.chainList";
let cmd = req.path;
try {
let res = await service.chainList();
return Res3Utils.result(res);
}
catch (e) {
logger.error(`${func_name} error:${e}`);
return Res3Utils.getErrorResult(e);
}
};
export const save = async (req: any, param: AddParam) => { export const save = async (req: any, param: AddParam) => {
let func_name = "coinTypeCtl.save"; let func_name = "coinTypeCtl.save";
let cmd = req.path; let cmd = req.path;
......
...@@ -25,6 +25,8 @@ export interface AddParam { ...@@ -25,6 +25,8 @@ export interface AddParam {
symbol: string; symbol: string;
asset_id: number;
is_active: number; is_active: number;
is_main: number; is_main: number;
...@@ -127,12 +129,44 @@ export async function list(param: ListParam) { ...@@ -127,12 +129,44 @@ export async function list(param: ListParam) {
return resList; return resList;
} }
export async function chainList() {
let resList = await coinType.prototype.findAll({
attributes:['chain_type'],
where: {
is_main:1
},
raw: true
});
let chains:any[] = [];
for (let item of resList) {
let chainType = item.chain_type;
chains.push(chainType)
}
return chains;
}
export const save = async (param: AddParam, currentUserId: any, ip: any) => { export const save = async (param: AddParam, currentUserId: any, ip: any) => {
if (!param.weight) { if (!param.weight) {
param.weight = 0; param.weight = 0;
} }
param.updatedAt = new Date(); param.updatedAt = new Date();
param.createdAt = new Date(); param.createdAt = new Date();
let general_name = param.general_name;
let exist = await coinType.prototype.findOne({ // 同名币判断
where: {
is_main: 1,
general_name: general_name,
},
raw: true
});
if (exist) {
param.is_main = 0;
param.asset_id = 0;
}else {
param.is_main = 1;
param.asset_id = exist.asset_id;
param.main_status = exist.main_status;
}
await coinType.prototype.create(param); await coinType.prototype.create(param);
//管理后台操作日志 //管理后台操作日志
addOptLog(currentUserId, 0, '币种管理新增', ip, JSON.stringify(param), '币种管理'); addOptLog(currentUserId, 0, '币种管理新增', ip, JSON.stringify(param), '币种管理');
......
...@@ -82,6 +82,8 @@ const postFunc = { ...@@ -82,6 +82,8 @@ const postFunc = {
'coinType/getAllSubmitSuccess': coinTypeCtrl.getAllSubmitSuccess, 'coinType/getAllSubmitSuccess': coinTypeCtrl.getAllSubmitSuccess,
'coinType/audit': coinTypeCtrl.audit, 'coinType/audit': coinTypeCtrl.audit,
'coinType/mixinCoinList': coinTypeCtrl.mixinCoinList, 'coinType/mixinCoinList': coinTypeCtrl.mixinCoinList,
'coinType/chainList': coinTypeCtrl.chainList,
//权限管理 - 我的权限 //权限管理 - 我的权限
'user/getInfo': userOptCtrl.getInfo, 'user/getInfo': userOptCtrl.getInfo,
......
...@@ -32,6 +32,7 @@ let cmdWhiteList = { ...@@ -32,6 +32,7 @@ let cmdWhiteList = {
'coinType/save': 1, 'coinType/save': 1,
'coinType/update': 1, 'coinType/update': 1,
'coinType/list': 1, 'coinType/list': 1,
'coinType/chainList': 1,
'coinType/pushToCoreSystem': 1, 'coinType/pushToCoreSystem': 1,
'coinType/getAllSubmitSuccess': 1, 'coinType/getAllSubmitSuccess': 1,
'coinType/audit': 1, 'coinType/audit': 1,
......
...@@ -23,6 +23,8 @@ const ExcludeApi = { ...@@ -23,6 +23,8 @@ const ExcludeApi = {
'department/allList': 1, 'department/allList': 1,
'operate/other/business/area/list': 1, 'operate/other/business/area/list': 1,
'coinType/mixinCoinList': 1, 'coinType/mixinCoinList': 1,
'coinType/chainList': 1,
}; };
//管理员需要强制绑定,该位置做特殊处理 //管理员需要强制绑定,该位置做特殊处理
const AdminExcludeApi = { const AdminExcludeApi = {
......
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