@cpzxrobot/sdk 1.3.72 → 1.3.74

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/device_gateway.ts CHANGED
@@ -991,8 +991,14 @@ export class DeviceGateway extends Object {
991
991
  * @param factoryId 工厂ID
992
992
  * @returns Promise 包含告警统计信息的数据
993
993
  */
994
- async getAlarmStats(factoryId: number): Promise<DeviceAlarmStatsResponse> {
994
+ async getAlarmStats(factoryId: number | undefined = undefined): Promise<DeviceAlarmStatsResponse> {
995
995
  const axios = await this.context.ready;
996
+
997
+ if (!factoryId) {
998
+ const farm = await this.context.user.getSelectedFarm();
999
+ factoryId = farm?.id || 0;
1000
+ }
1001
+
996
1002
  return axios.get(`/api/v2/device/stat/alarms`, {
997
1003
  params: { factoryId }
998
1004
  }).then((res) => {
@@ -785,9 +785,13 @@ class DeviceGateway extends Object {
785
785
  * @param factoryId 工厂ID
786
786
  * @returns Promise 包含告警统计信息的数据
787
787
  */
788
- getAlarmStats(factoryId) {
789
- return __awaiter(this, void 0, void 0, function* () {
788
+ getAlarmStats() {
789
+ return __awaiter(this, arguments, void 0, function* (factoryId = undefined) {
790
790
  const axios = yield this.context.ready;
791
+ if (!factoryId) {
792
+ const farm = yield this.context.user.getSelectedFarm();
793
+ factoryId = (farm === null || farm === void 0 ? void 0 : farm.id) || 0;
794
+ }
791
795
  return axios.get(`/api/v2/device/stat/alarms`, {
792
796
  params: { factoryId }
793
797
  }).then((res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.72",
3
+ "version": "1.3.74",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {