@cpzxrobot/sdk 1.0.41 → 1.0.43

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/camera_gateway.ts CHANGED
@@ -7,6 +7,7 @@ export class CameraGateway extends Object {
7
7
  this.context = context;
8
8
  }
9
9
 
10
+ //查询摄像头,如果传unit,按单元搜索,或者有unit_id,优先使用unit_id,然后使用workshop_id,最后使用factory_id,查询对应的摄像头
10
11
  async search(
11
12
  data:
12
13
  | Unit
package/device_filter.ts CHANGED
@@ -99,6 +99,9 @@ export abstract class DeviceFilter<T extends { id: number }> {
99
99
  }
100
100
 
101
101
  //获取设备数据,和getData相同作用,为统一接口进行了重命名
102
+ // diffPerDay: 每天差值, 注意这个只是差值,不是开始值和结束值
103
+ // last: 每个周期最新, 如果需要获得每天的最新数据,需要设置start和stop,然后设置period为1d,这样可以获得每天的最后数据
104
+ // 如果需要查询18点到18点的数据,需要设置offset为18h
102
105
  get data() {
103
106
  return this.getData;
104
107
  }
@@ -281,6 +284,7 @@ export abstract class DeviceFilter<T extends { id: number }> {
281
284
  | "latest"
282
285
  | "weekoverweek"
283
286
  | "last"
287
+ | "rangeOfDay"
284
288
  | "rangeToday"
285
289
  | null; //如果data为null,则不获取数据,只获取设备列表,否则获取设备列表和数据
286
290
  status?: string;
@@ -6,6 +6,7 @@ class CameraGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
+ //查询摄像头,如果传unit,按单元搜索,或者有unit_id,优先使用unit_id,然后使用workshop_id,最后使用factory_id,查询对应的摄像头
9
10
  async search(data) {
10
11
  var axios = await this.context.ready;
11
12
  var params = {};
@@ -82,6 +82,9 @@ class DeviceFilter {
82
82
  });
83
83
  }
84
84
  //获取设备数据,和getData相同作用,为统一接口进行了重命名
85
+ // diffPerDay: 每天差值, 注意这个只是差值,不是开始值和结束值
86
+ // last: 每个周期最新, 如果需要获得每天的最新数据,需要设置start和stop,然后设置period为1d,这样可以获得每天的最后数据
87
+ // 如果需要查询18点到18点的数据,需要设置offset为18h
85
88
  get data() {
86
89
  return this.getData;
87
90
  }
package/dist/index.js CHANGED
@@ -229,6 +229,22 @@ class Cpzxrobot {
229
229
  }
230
230
  this.resolveReady(this.axios);
231
231
  });
232
+ //load www.cpzxrobot.com/web_components.js as web components
233
+ // const script = document.createElement("script");
234
+ // script.src = "https://www.cpzxrobot.com/web_components.js";
235
+ // document.body.appendChild(script);
236
+ // //insert cpzxrobot_web_components into body
237
+ // const div = document.createElement("cpzxrobot_web_components");
238
+ // document.body.appendChild(div);
239
+ // //register onUnitChanged and onFactoryChanged on div
240
+ // div.addEventListener("unitChanged", function (e: any) {
241
+ // // @ts-ignore
242
+ // window._notifyUnitChanged(e.detail);
243
+ // });
244
+ // div.addEventListener("factoryChanged", function (e: any) {
245
+ // // @ts-ignore
246
+ // window._notifyFactoryChanged(e.detail);
247
+ // });
232
248
  return;
233
249
  }
234
250
  else {
@@ -61,7 +61,7 @@ class PigfarmGateway extends Object {
61
61
  },
62
62
  update: async (lamp) => {
63
63
  var axios = await this.context.ready;
64
- return axios.get(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
64
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
65
65
  },
66
66
  };
67
67
  }
package/index.ts CHANGED
@@ -264,6 +264,22 @@ export class Cpzxrobot {
264
264
  }
265
265
  this.resolveReady(this.axios);
266
266
  });
267
+ //load www.cpzxrobot.com/web_components.js as web components
268
+ // const script = document.createElement("script");
269
+ // script.src = "https://www.cpzxrobot.com/web_components.js";
270
+ // document.body.appendChild(script);
271
+ // //insert cpzxrobot_web_components into body
272
+ // const div = document.createElement("cpzxrobot_web_components");
273
+ // document.body.appendChild(div);
274
+ // //register onUnitChanged and onFactoryChanged on div
275
+ // div.addEventListener("unitChanged", function (e: any) {
276
+ // // @ts-ignore
277
+ // window._notifyUnitChanged(e.detail);
278
+ // });
279
+ // div.addEventListener("factoryChanged", function (e: any) {
280
+ // // @ts-ignore
281
+ // window._notifyFactoryChanged(e.detail);
282
+ // });
267
283
  return;
268
284
  } else {
269
285
  //if url has access_token and app_code, use it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -73,7 +73,7 @@ export class PigfarmGateway extends Object {
73
73
  },
74
74
  update:async (lamp: HeatLamp):Promise<any>=> {
75
75
  var axios = await this.context.ready;
76
- return axios.get(`/api/v1/pigfarm/heatLamp/config/update`,lamp)
76
+ return axios.post(`/api/v1/pigfarm/heatLamp/config/update`,lamp)
77
77
  },
78
78
  };
79
79
  }
package/types.d.ts CHANGED
@@ -151,11 +151,14 @@ export interface DataQueryArgs {
151
151
  type?:
152
152
  | "diffPerDay"
153
153
  | "sumPerDay"
154
+ | "rangeOfDay"
155
+ | "rangeToday"
154
156
  | "latest"
155
157
  | "latestInRangePerDay"
156
158
  | "last"
157
159
  | "difference";
158
160
  period?: "1mo" | "1d" | null;
161
+ offset?: string; // 可以设置统计偏移量,比如设置18h, 则统计从当天晚上6点开始
159
162
  [key: string]: any;
160
163
  }
161
164