1
This commit is contained in:
parent
8fd77fd8dc
commit
ddba7238ac
@ -25,8 +25,24 @@ function registerMetaClass(fileName, primKey, wrapClass, aliseName = '') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load() {
|
function onAllLoadPost(classList) {
|
||||||
metaClassList.forEach((metaClass) => {
|
for (let i = 0; i < 3; ++i) {
|
||||||
|
classList.forEach((metaClass) => {
|
||||||
|
metaClass['wrapList'].forEach((item) => {
|
||||||
|
if (item['_init' + i]) {
|
||||||
|
item['_init' + i](exports);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
classList.forEach((metaClass) => {
|
||||||
|
metaClass['wrapList'].forEach((item) => {
|
||||||
|
item.lock();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadMeta(metaClass) {
|
||||||
const json = utils.readJsonFromFile(metaClass['fileName']);
|
const json = utils.readJsonFromFile(metaClass['fileName']);
|
||||||
if (!json) {
|
if (!json) {
|
||||||
throw new Error('读取配置' + metaClass['fileName'] + '失败');
|
throw new Error('读取配置' + metaClass['fileName'] + '失败');
|
||||||
@ -51,24 +67,14 @@ function load() {
|
|||||||
}
|
}
|
||||||
++idx;
|
++idx;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function load() {
|
||||||
|
metaClassList.forEach((metaClass) => {
|
||||||
|
loadMeta(metaClass);
|
||||||
//log.debug(utils.jsonEncode(metaClass));
|
//log.debug(utils.jsonEncode(metaClass));
|
||||||
});
|
});
|
||||||
{
|
onAllLoadPost(metaClassList);
|
||||||
for (let i = 0; i < 3; ++i) {
|
|
||||||
metaClassList.forEach((metaClass) => {
|
|
||||||
metaClass['wrapList'].forEach((item) => {
|
|
||||||
if (item['_init' + i]) {
|
|
||||||
item['_init' + i](exports);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
metaClassList.forEach((metaClass) => {
|
|
||||||
metaClass['wrapList'].forEach((item) => {
|
|
||||||
item.lock();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
@ -115,13 +121,18 @@ function init() {
|
|||||||
|
|
||||||
load();
|
load();
|
||||||
{
|
{
|
||||||
|
const classList = [];
|
||||||
getMetaByKey('PresentList', '0')['list'].forEach((item) => {
|
getMetaByKey('PresentList', '0')['list'].forEach((item) => {
|
||||||
registerMetaClass(resDir + item + '@present.json',
|
registerMetaClass(resDir + item + '@present.json',
|
||||||
'id',
|
'id',
|
||||||
'Present',
|
'Present',
|
||||||
'Present' + item
|
'Present' + item
|
||||||
);
|
);
|
||||||
|
const metaClass = getMetaClass('Present' + item);
|
||||||
|
loadMeta(metaClass);
|
||||||
|
classList.push(metaClass);
|
||||||
});
|
});
|
||||||
|
onAllLoadPost(classList);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
traverseMetaList('MarketDb', (dbConf, idx) => {
|
traverseMetaList('MarketDb', (dbConf, idx) => {
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
const BaseService = require('./baseservice');
|
const BaseService = require('./baseservice');
|
||||||
|
const metaFactory = require('../metadata/factory');
|
||||||
|
|
||||||
class Present extends BaseService {
|
class Present extends BaseService {
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
|
const presentList = metaFactory.getMetaByKey('PresentList', '0')['list'];
|
||||||
|
for (let i in presentList) {
|
||||||
|
const name = presentList[i];
|
||||||
|
metaFactory.traverseMetaList('Present' + name, (item) => {
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user