@cpzxrobot/sdk 1.0.79 → 1.0.80

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.
@@ -42,7 +42,10 @@ export class FeedTowerGateway extends DeviceFilter<FeedTower> {
42
42
  throw res[0].data.Error;
43
43
  } else {
44
44
  if (!args.ingoreInput) {
45
- res[1].data.data.forEach((item: any) => {
45
+ if (res[1].data.data.list == undefined){
46
+ throw "未查询到饲料下料数据,请联系管理员";
47
+ }
48
+ res[1].data.data.list.forEach((item: any) => {
46
49
  res[0].data[item.date] += item.data;
47
50
  });
48
51
  }
@@ -32,7 +32,10 @@ class FeedTowerGateway extends device_filter_1.DeviceFilter {
32
32
  }
33
33
  else {
34
34
  if (!args.ingoreInput) {
35
- res[1].data.data.forEach((item) => {
35
+ if (res[1].data.data.list == undefined) {
36
+ throw "未查询到饲料下料数据,请联系管理员";
37
+ }
38
+ res[1].data.data.list.forEach((item) => {
36
39
  res[0].data[item.date] += item.data;
37
40
  });
38
41
  }
@@ -57,12 +57,23 @@ class UnitGateway extends Object {
57
57
  return axios.get(`/api/v2/unit/delete?id=${unit.id}`);
58
58
  });
59
59
  },
60
- //获取单元的展示布局信息
61
- layout: (unit) => {
60
+ };
61
+ }
62
+ layout() {
63
+ return {
64
+ get: (unit) => {
62
65
  return this.context.ready.then((axios) => {
63
66
  return axios.get(`/api/v2/unit/config/appLayout/${unit.id}`);
64
67
  });
65
68
  },
69
+ post: (unit, layout) => {
70
+ return this.context.ready.then((axios) => {
71
+ return axios.post(`/api/v2/unit/config/appLayout`, {
72
+ id: unit.id,
73
+ layout,
74
+ });
75
+ });
76
+ },
66
77
  };
67
78
  }
68
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -109,7 +109,8 @@ baseURL: "/"
109
109
  | cpzxrobot().unit.v2.add | 添加单元,v2版本 |
110
110
  | cpzxrobot().unit.v2.update | 更新单元,v2版本 |
111
111
  | cpzxrobot().unit.v2.delete | 删除单元,v2版本 |
112
- | cpzxrobot().unit.v2.layout | 获取单元的展示布局,v2版本 |
112
+ | cpzxrobot().unit.layout.get | 获取单元的展示布局 |
113
+ | cpzxrobot().unit.layout.post | 设置单元的展示布局 |
113
114
 
114
115
 
115
116
  ### 工厂信息接口
package/unit_gateway.ts CHANGED
@@ -72,12 +72,24 @@ export class UnitGateway extends Object {
72
72
  return axios.get(`/api/v2/unit/delete?id=${unit.id}`);
73
73
  });
74
74
  },
75
- //获取单元的展示布局信息
76
- layout: (unit: Unit) => {
75
+ };
76
+ }
77
+
78
+ layout() {
79
+ return {
80
+ get: (unit: Unit) => {
77
81
  return this.context.ready.then((axios) => {
78
82
  return axios.get(`/api/v2/unit/config/appLayout/${unit.id}`);
79
83
  });
80
84
  },
85
+ post: (unit: Unit, layout: any) => {
86
+ return this.context.ready.then((axios) => {
87
+ return axios.post(`/api/v2/unit/config/appLayout`, {
88
+ id: unit.id,
89
+ layout,
90
+ });
91
+ });
92
+ },
81
93
  };
82
94
  }
83
95
  }