@cpzxrobot/sdk 1.0.37 → 1.0.38

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
@@ -6,11 +6,22 @@ export class CameraGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
- //搜索摄像头
9
+ //搜索摄像头,传入unit对象或者unit的id
10
10
  async search(data: Unit): Promise<any> {
11
11
  var axios = await this.context.ready;
12
+ var id = data.id;
13
+
14
+ if (!id) {
15
+ //if data is string
16
+ if (typeof data === "string") {
17
+ id = data;
18
+ }else{
19
+ throw new Error("请传入正确的Unit对象");
20
+ }
21
+ }
22
+
12
23
  const response = await axios.post("/api/v1/camera/search", {
13
- unit_id: data.id,
24
+ unit_id: id,
14
25
  });
15
26
  return response.data;
16
27
  }
@@ -6,11 +6,21 @@ class CameraGateway extends Object {
6
6
  super();
7
7
  this.context = context;
8
8
  }
9
- //搜索摄像头
9
+ //搜索摄像头,传入unit对象或者unit的id
10
10
  async search(data) {
11
11
  var axios = await this.context.ready;
12
+ var id = data.id;
13
+ if (!id) {
14
+ //if data is string
15
+ if (typeof data === "string") {
16
+ id = data;
17
+ }
18
+ else {
19
+ throw new Error("请传入正确的Unit对象");
20
+ }
21
+ }
12
22
  const response = await axios.post("/api/v1/camera/search", {
13
- unit_id: data.id,
23
+ unit_id: id,
14
24
  });
15
25
  return response.data;
16
26
  }
@@ -37,7 +37,7 @@ class TransportGateway extends Object {
37
37
  getDeviceByFodderld: (id) => {
38
38
  return this.context.ready.then(() => {
39
39
  return this.context.axios
40
- .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderld", {
40
+ .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderId", {
41
41
  params: {
42
42
  fodderld: id,
43
43
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -125,4 +125,13 @@ factory_id: 工厂id
125
125
 
126
126
  `cpzxrobot().saveBase64(base64,filename)`
127
127
 
128
- 保存Base64内容为文件
128
+ 保存Base64内容为文件
129
+
130
+ ### 保温灯相关接口
131
+
132
+ heatlamp 属性提供了一组方法,用于管理猪场的热灯配置。它包含以下方法:
133
+
134
+ **cpzxrobot().pigfarm.heatlamp.add(unit, data)**:添加新的热灯配置。
135
+ **cpzxrobot().pigfarm.heatlamp.list(unit)**:列出指定单元的所有热灯配置。
136
+ **cpzxrobot().pigfarm.heatlamp.get(id)**:获取指定 ID 的热灯配置。
137
+ **cpzxrobot().pigfarm.heatlamp.update(lamp)**:更新热灯配置。
@@ -44,10 +44,10 @@ export class TransportGateway extends Object {
44
44
  return this.getDetail;
45
45
  },
46
46
  //按料单获得对应的料塔
47
- getDeviceByFodderld: (id: number): Promise<any> => {
47
+ getDeviceByFodderld: (id: string): Promise<any> => {
48
48
  return this.context.ready.then(() => {
49
49
  return this.context.axios
50
- .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderld", {
50
+ .get("/api/v1/pigfarm/device/fodderTower/getDeviceByFodderId", {
51
51
  params: {
52
52
  fodderld: id,
53
53
  },