@ibiz-template/model-helper 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -14980,9 +14980,35 @@ var ModelUtil = class {
14980
14980
  }
14981
14981
  const model = await this.get(url);
14982
14982
  this.modelCache.set(url, model);
14983
- model.appId = this.appId;
14983
+ this.deepFillAppId(model);
14984
14984
  return model;
14985
14985
  }
14986
+ /**
14987
+ * 递归填充应用标识
14988
+ *
14989
+ * @author chitanda
14990
+ * @date 2023-08-21 10:08:41
14991
+ * @protected
14992
+ * @param {IModel} model
14993
+ */
14994
+ deepFillAppId(model) {
14995
+ model.appId = this.appId;
14996
+ const keys = Object.keys(model);
14997
+ keys.forEach((key) => {
14998
+ const value = model[key];
14999
+ if (value && typeof value === "object") {
15000
+ if (Array.isArray(value)) {
15001
+ value.forEach((item) => {
15002
+ if (item && typeof item === "object") {
15003
+ this.deepFillAppId(item);
15004
+ }
15005
+ });
15006
+ } else {
15007
+ this.deepFillAppId(value);
15008
+ }
15009
+ }
15010
+ });
15011
+ }
14986
15012
  /**
14987
15013
  * 计算应用模型请求路径
14988
15014
  *