1
This commit is contained in:
parent
8fd77fd8dc
commit
ddba7238ac
@ -25,8 +25,24 @@ function registerMetaClass(fileName, primKey, wrapClass, aliseName = '') {
|
||||
}
|
||||
}
|
||||
|
||||
function load() {
|
||||
metaClassList.forEach((metaClass) => {
|
||||
function onAllLoadPost(classList) {
|
||||
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']);
|
||||
if (!json) {
|
||||
throw new Error('读取配置' + metaClass['fileName'] + '失败');
|
||||
@ -51,24 +67,14 @@ function load() {
|
||||
}
|
||||
++idx;
|
||||
});
|
||||
}
|
||||
|
||||
function load() {
|
||||
metaClassList.forEach((metaClass) => {
|
||||
loadMeta(metaClass);
|
||||
//log.debug(utils.jsonEncode(metaClass));
|
||||
});
|
||||
{
|
||||
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();
|
||||
});
|
||||
});
|
||||
}
|
||||
onAllLoadPost(metaClassList);
|
||||
}
|
||||
|
||||
function init() {
|
||||
@ -115,13 +121,18 @@ function init() {
|
||||
|
||||
load();
|
||||
{
|
||||
const classList = [];
|
||||
getMetaByKey('PresentList', '0')['list'].forEach((item) => {
|
||||
registerMetaClass(resDir + item + '@present.json',
|
||||
'id',
|
||||
'Present',
|
||||
'Present' + item
|
||||
);
|
||||
const metaClass = getMetaClass('Present' + item);
|
||||
loadMeta(metaClass);
|
||||
classList.push(metaClass);
|
||||
});
|
||||
onAllLoadPost(classList);
|
||||
}
|
||||
{
|
||||
traverseMetaList('MarketDb', (dbConf, idx) => {
|
||||
|
@ -1,9 +1,15 @@
|
||||
const BaseService = require('./baseservice');
|
||||
const metaFactory = require('../metadata/factory');
|
||||
|
||||
class Present extends BaseService {
|
||||
|
||||
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