|
@@ -735,33 +735,39 @@ function ext_getFee(feeKey, dtlFeeKey) {
|
|
|
let dtObj = parentObj["myOwnRawDataObj"];
|
|
|
if (feeKey && dtObj) {
|
|
|
for (let dItem of dtObj.data) {
|
|
|
- let hasValue = false;
|
|
|
- if (dItem.hasOwnProperty("fees")) {
|
|
|
- for (let fee of dItem["fees"]) {
|
|
|
- if (fee["fieldName"] === feeKey) {
|
|
|
- if (dtlFeeKey) {
|
|
|
- rst.push(fee[dtlFeeKey]);
|
|
|
- } else {
|
|
|
- rst.push(fee["unitFee"]);
|
|
|
- }
|
|
|
- hasValue = true;
|
|
|
- break;
|
|
|
- }
|
|
|
+ rst.push(pri_getFee(dItem, feeKey, dtlFeeKey));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let i = 0; i < rst.length; i++) {
|
|
|
+ rst[i] = parseFloat(rst[i]);
|
|
|
+ }
|
|
|
+ return rst;
|
|
|
+}
|
|
|
+
|
|
|
+function pri_getFee(dItem, feeKey, dtlFeeKey) {
|
|
|
+ let rst = 0;
|
|
|
+ let hasValue = false;
|
|
|
+ if (dItem.hasOwnProperty("fees")) {
|
|
|
+ for (let fee of dItem["fees"]) {
|
|
|
+ if (fee["fieldName"] === feeKey) {
|
|
|
+ if (dtlFeeKey) {
|
|
|
+ rst = fee[dtlFeeKey];
|
|
|
+ } else {
|
|
|
+ rst = fee["unitFee"];
|
|
|
}
|
|
|
- } else if (dItem.hasOwnProperty(feeKey)) {
|
|
|
- hasValue = true;
|
|
|
- rst.push(dItem[feeKey]);
|
|
|
- } else {
|
|
|
hasValue = true;
|
|
|
- rst.push(0);
|
|
|
- }
|
|
|
- if (!hasValue) {
|
|
|
- rst.push(0);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
+ } else if (dItem.hasOwnProperty(feeKey)) {
|
|
|
+ hasValue = true;
|
|
|
+ rst = dItem[feeKey];
|
|
|
+ } else {
|
|
|
+ hasValue = true;
|
|
|
+ rst = 0;
|
|
|
}
|
|
|
- for (let i = 0; i < rst.length; i++) {
|
|
|
- rst[i] = parseFloat(rst[i]);
|
|
|
+ if (!hasValue) {
|
|
|
+ rst = 0;
|
|
|
}
|
|
|
return rst;
|
|
|
}
|
|
@@ -868,7 +874,7 @@ function ext_getPropertyByFlag(flagVal, rstKey, dftValIfEmpty) {
|
|
|
if (flagVal && rstKey && dtObj) {
|
|
|
let isArr = (flagVal instanceof Array);
|
|
|
for (let dItem of dtObj.data) {
|
|
|
- let doc = (dItem._doc === null || dItem._doc === undefined)?dItem:dItem._doc;
|
|
|
+ let doc = (dItem._doc)?dItem._doc:dItem;
|
|
|
if (doc.hasOwnProperty("flags")) {
|
|
|
let bFlag = false;
|
|
|
for (let flagItem of doc.flags) {
|
|
@@ -882,13 +888,18 @@ function ext_getPropertyByFlag(flagVal, rstKey, dftValIfEmpty) {
|
|
|
if (bFlag) break;
|
|
|
}
|
|
|
if (bFlag) {
|
|
|
- rst.push(doc[rstKey]);
|
|
|
+ let keys = rstKey.split(".");
|
|
|
+ if (keys[0] === "fees") {
|
|
|
+ rst.push(pri_getFee(doc, "common", keys[1]));
|
|
|
+ } else {
|
|
|
+ //其他,比如名称什么
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (rst.length === 0 && dftValIfEmpty) {
|
|
|
+ if (rst.length === 0 && dftValIfEmpty !== null) {
|
|
|
rst.push(dftValIfEmpty);
|
|
|
}
|
|
|
return rst;
|