This commit is contained in:
aozhiwei 2023-07-02 09:30:16 +08:00
parent 832b7f6d82
commit aaf7b63151

View File

@ -5,7 +5,7 @@ const log = require('j7/log');
const metaClassList = []; const metaClassList = [];
const metaClasses = {}; const metaClasses = {};
const web3ConfHash = {}; const web3ConfHash = {};
let web3ServiceConf = null; let web3BcSpiderConf = null;
let configDir = './config/'; let configDir = './config/';
function registerMetaClass(fileName, primKey, wrapClass) { function registerMetaClass(fileName, primKey, wrapClass) {
@ -94,23 +94,18 @@ async function init() {
'', '',
'BlockChainDb' 'BlockChainDb'
); );
registerMetaClass(configDir + 'web3service.cluster.json', registerMetaClass(configDir + 'web3bcspider.cluster.json',
'', '',
'Web3Service' 'Web3BcSpider'
); );
// registerMetaClass(resDir + 'item@item.json',
// 'id',
// 'Item'
// );
load(); load();
{ {
traverseMetaList('BlockChainDb', (dbConf, idx) => { traverseMetaList('BlockChainDb', (dbConf, idx) => {
app.registerDb('BlockChainDb' + idx, dbConf); app.registerDb('BlockChainDb' + idx, dbConf);
}); });
traverseMetaList('Web3Service', (item, idx) => { traverseMetaList('Web3BcSpider', (item, idx) => {
if (item['instance_id'] == app.getInstanceId()) { if (item['instance_id'] == app.getInstanceId()) {
web3ServiceConf = item; web3BcSpiderConf = item;
item['nets'].forEach((netId) => { item['nets'].forEach((netId) => {
const netDir = configDir + 'nets/' + netId + '/'; const netDir = configDir + 'nets/' + netId + '/';
web3ConfHash[netId] = { web3ConfHash[netId] = {
@ -163,8 +158,8 @@ function getWeb3Conf(netId) {
return null; return null;
} }
function getWeb3ServiceConf() { function getWeb3BcSpiderConf() {
return web3ServiceConf; return web3BcSpiderConf;
} }
function getContractsConf(netId) { function getContractsConf(netId) {
@ -198,7 +193,7 @@ exports.traverseMetaList = traverseMetaList;
exports.callMetaStatic = callMetaStatic; exports.callMetaStatic = callMetaStatic;
exports.getWeb3Conf = getWeb3Conf; exports.getWeb3Conf = getWeb3Conf;
exports.getWeb3ServiceConf = getWeb3ServiceConf; exports.getWeb3BcSpiderConf = getWeb3BcSpiderConf;
exports.getContractsConf = getContractsConf; exports.getContractsConf = getContractsConf;
exports.getNetList = getNetList; exports.getNetList = getNetList;
exports.getNetDir = getNetDir; exports.getNetDir = getNetDir;