|
@@ -90,6 +90,18 @@ const loadModel2 = (app, tenant) => {
|
|
|
return model;
|
|
|
};
|
|
|
|
|
|
+const getAllModel = data => {
|
|
|
+ if(_.isFunction(data)) return data;
|
|
|
+ const keys = Object.keys(data);
|
|
|
+ const arr = [];
|
|
|
+ for (const key of keys) {
|
|
|
+ const model = data[key];
|
|
|
+ if(_.isFunction(model)) arr.push(model)
|
|
|
+ else arr.push(...getAllModel(model))
|
|
|
+ }
|
|
|
+ return arr;
|
|
|
+}
|
|
|
+
|
|
|
// this 就是 app 对象,在其中可以调用 app 上的其他方法,或访问属性
|
|
|
module.exports = {
|
|
|
|