ntk-cms-api 1.2.239 → 1.2.241
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/esm2020/lib/service/base/apiCmsServerBase.service.mjs +6 -12
- package/esm2020/lib/service/base/apiServerBase.service.mjs +10 -1
- package/esm2020/lib/service/core-main/coreEnum.service.mjs +6 -8
- package/fesm2015/ntk-cms-api.mjs +19 -20
- package/fesm2015/ntk-cms-api.mjs.map +1 -1
- package/fesm2020/ntk-cms-api.mjs +19 -18
- package/fesm2020/ntk-cms-api.mjs.map +1 -1
- package/lib/service/base/apiServerBase.service.d.ts +1 -0
- package/package.json +1 -1
package/fesm2020/ntk-cms-api.mjs
CHANGED
|
@@ -1275,6 +1275,15 @@ class ApiServerBase {
|
|
|
1275
1275
|
localStorage.setItem(this.keyBaseUrl, url);
|
|
1276
1276
|
this.configApiRetry = apiRetry;
|
|
1277
1277
|
}
|
|
1278
|
+
cashApiIsValid(serviceNameKay) {
|
|
1279
|
+
if (!this.cachApiResult[serviceNameKay])
|
|
1280
|
+
return false;
|
|
1281
|
+
if (!this.cachApiResult[serviceNameKay].isSuccess)
|
|
1282
|
+
return true;
|
|
1283
|
+
if (this.cachApiResult[serviceNameKay].dateResult && (new Date().getTime() - this.cachApiResult[serviceNameKay].dateResult) < this.cashApiSeconds)
|
|
1284
|
+
return true;
|
|
1285
|
+
return false;
|
|
1286
|
+
}
|
|
1278
1287
|
childConstructor() {
|
|
1279
1288
|
// test
|
|
1280
1289
|
}
|
|
@@ -1679,16 +1688,8 @@ class ApiCmsServerBase extends ApiServerBase {
|
|
|
1679
1688
|
const serviceName = 'ServiceGetOneById';
|
|
1680
1689
|
const serviceNameKay = serviceName + '_' + id;
|
|
1681
1690
|
if (this.getModuleCashService().includes(serviceName)) {
|
|
1682
|
-
if (this.
|
|
1683
|
-
|
|
1684
|
-
return of(this.cachApiResult[serviceNameKay]);
|
|
1685
|
-
this.cachApiResult[serviceNameKay] = null;
|
|
1686
|
-
}
|
|
1687
|
-
while (this.cachApiCallDate[serviceNameKay] && (new Date().getTime() - this.cachApiCallDate[serviceNameKay].getTime()) < this.cashApiSeconds) {
|
|
1688
|
-
if (this.cachApiResult[serviceNameKay]?.isSuccess)
|
|
1689
|
-
return of(this.cachApiResult[serviceNameKay]);
|
|
1690
|
-
}
|
|
1691
|
-
this.cachApiCallDate[serviceNameKay] = new Date();
|
|
1691
|
+
if (this.cashApiIsValid(serviceNameKay))
|
|
1692
|
+
return of(this.cachApiResult[serviceNameKay]);
|
|
1692
1693
|
}
|
|
1693
1694
|
//! optimaze call api
|
|
1694
1695
|
// this.loadingStatus=true;
|
|
@@ -1700,8 +1701,10 @@ class ApiCmsServerBase extends ApiServerBase {
|
|
|
1700
1701
|
// catchError(this.handleError)
|
|
1701
1702
|
map((ret) => {
|
|
1702
1703
|
//! optimaze call api
|
|
1703
|
-
if (this.getModuleCashService().includes(serviceName))
|
|
1704
|
+
if (this.getModuleCashService().includes(serviceName)) {
|
|
1704
1705
|
this.cachApiResult[serviceNameKay] = ret;
|
|
1706
|
+
this.cachApiResult[serviceNameKay].dateResult = new Date();
|
|
1707
|
+
}
|
|
1705
1708
|
//! optimaze call api
|
|
1706
1709
|
return this.errorExceptionResultCheck(ret);
|
|
1707
1710
|
}));
|
|
@@ -2153,13 +2156,8 @@ class CoreEnumService extends ApiServerBase {
|
|
|
2153
2156
|
const serviceName = 'ServiceRecordStatusEnum';
|
|
2154
2157
|
const serviceNameKay = serviceName;
|
|
2155
2158
|
if (this.getModuleCashService().includes(serviceName)) {
|
|
2156
|
-
if (this.
|
|
2159
|
+
if (this.cashApiIsValid(serviceNameKay))
|
|
2157
2160
|
return of(this.cachApiResult[serviceNameKay]);
|
|
2158
|
-
while (this.cachApiCallDate[serviceNameKay] && (new Date().getTime() - this.cachApiCallDate[serviceNameKay].getTime()) < this.cashApiSeconds) {
|
|
2159
|
-
if (this.cachApiResult[serviceNameKay]?.isSuccess)
|
|
2160
|
-
return of(this.cachApiResult[serviceNameKay]);
|
|
2161
|
-
}
|
|
2162
|
-
this.cachApiCallDate[serviceNameKay] = new Date();
|
|
2163
2161
|
}
|
|
2164
2162
|
//! optimaze call api
|
|
2165
2163
|
return this.http
|
|
@@ -2170,7 +2168,10 @@ class CoreEnumService extends ApiServerBase {
|
|
|
2170
2168
|
// catchError(this.handleError)
|
|
2171
2169
|
map((ret) => {
|
|
2172
2170
|
//! optimaze call api
|
|
2173
|
-
this.
|
|
2171
|
+
if (this.getModuleCashService().includes(serviceName)) {
|
|
2172
|
+
this.cachApiResult[serviceNameKay] = ret;
|
|
2173
|
+
this.cachApiResult[serviceNameKay].dateResult = new Date();
|
|
2174
|
+
}
|
|
2174
2175
|
//! optimaze call api
|
|
2175
2176
|
return this.errorExceptionResultCheck(ret);
|
|
2176
2177
|
}));
|