@cpzxrobot/sdk 1.3.92 → 1.3.93

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
@@ -216,7 +216,7 @@ export class DeviceGateway extends Object {
216
216
  // 参数验证
217
217
  if (!factoryId) {
218
218
  let farm = await this.context.user.getSelectedFarm();
219
- factoryId = farm?.id || 0;
219
+ factoryId = farm?.id || 0;
220
220
  }
221
221
 
222
222
  return axios.get(`/api/v2/device/stat/alarms/rule`, {
@@ -280,6 +280,19 @@ export class DeviceGateway extends Object {
280
280
  return res.data;
281
281
  });
282
282
  },
283
+ /**
284
+ * 删除报警规则
285
+ * @param id - 报警规则ID
286
+ */
287
+ delete: async (id: number): Promise<any> => {
288
+ const axios = await this.context.ready;
289
+ return axios.delete(`/api/v2/device/stat/alarms/rule/${id}`).then((res) => {
290
+ if (res.data.code !== 200) {
291
+ throw new Error(res.data.message || '删除报警规则失败');
292
+ }
293
+ return res.data;
294
+ });
295
+ },
283
296
  };
284
297
  }
285
298
 
@@ -1264,7 +1277,7 @@ export class DeviceGateway extends Object {
1264
1277
  params.duration = args.duration;
1265
1278
  }
1266
1279
  if (args.hourMode !== undefined) {
1267
- params.perHour = args.hourMode;
1280
+ params.perHour = args.hourMode;
1268
1281
  }
1269
1282
 
1270
1283
  return axios.get(`/api/v2/device/stat/alarms/trend`, {
@@ -212,6 +212,19 @@ class DeviceGateway extends Object {
212
212
  return res.data;
213
213
  });
214
214
  }),
215
+ /**
216
+ * 删除报警规则
217
+ * @param id - 报警规则ID
218
+ */
219
+ delete: (id) => __awaiter(this, void 0, void 0, function* () {
220
+ const axios = yield this.context.ready;
221
+ return axios.delete(`/api/v2/device/stat/alarms/rule/${id}`).then((res) => {
222
+ if (res.data.code !== 200) {
223
+ throw new Error(res.data.message || '删除报警规则失败');
224
+ }
225
+ return res.data;
226
+ });
227
+ }),
215
228
  };
216
229
  }
217
230
  constructor(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.92",
3
+ "version": "1.3.93",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {