@cpzxrobot/sdk 1.3.57 → 1.3.59

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.
@@ -259,10 +259,19 @@ class PigfarmGateway extends Object {
259
259
  var axios = await this.context.ready;
260
260
  return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
261
261
  },
262
+ //用于设置保温灯分组,TODO : 应该有更直观的命名
262
263
  updateByUnit: async (unit, lamp, ids = null) => {
263
264
  var axios = await this.context.ready;
264
265
  return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, Object.assign(Object.assign({}, lamp), { ids }));
265
266
  },
267
+ getGroup: async (unit) => {
268
+ var axios = await this.context.ready;
269
+ return axios.post(`/api/v1/pigfarm/heatLamp/group?unitId={unit.id}`);
270
+ },
271
+ deleteGroup: async (id) => {
272
+ var axios = await this.context.ready;
273
+ return axios.post(`/api/v1/pigfarm/heatLamp/deleteGroup?id=${id}`);
274
+ },
266
275
  switchByUnit: async (unit, action, ids = null) => {
267
276
  var axios = await this.context.ready;
268
277
  var args = {
@@ -106,6 +106,16 @@ class UnitGateway extends Object {
106
106
  return axios.post(`/api/v2/batch/unit/bind`, args);
107
107
  });
108
108
  },
109
+ //获得绑定在某个批次的某个类别的单元信息,当前支持温度补偿信息
110
+ info: (id, type) => {
111
+ return this.context.ready.then((axios) => {
112
+ return axios.get(`/api/v2/batch/unit/bind/${id}`, {
113
+ params: {
114
+ type
115
+ }
116
+ });
117
+ });
118
+ },
109
119
  update: (args) => {
110
120
  return this.context.ready.then((axios) => {
111
121
  return axios.post(`/api/v2/batch/unit/update`, args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.57",
3
+ "version": "1.3.59",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -318,6 +318,7 @@ export class PigfarmGateway extends Object {
318
318
  var axios = await this.context.ready;
319
319
  return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
320
320
  },
321
+ //用于设置保温灯分组,TODO : 应该有更直观的命名
321
322
  updateByUnit: async (unit: Unit, lamp: HeatLamp, ids: Number[] | null = null): Promise<any> => {
322
323
  var axios = await this.context.ready;
323
324
  return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, {
@@ -325,6 +326,14 @@ export class PigfarmGateway extends Object {
325
326
  ids
326
327
  });
327
328
  },
329
+ getGroup: async (unit: Unit): Promise<any> => {
330
+ var axios = await this.context.ready;
331
+ return axios.post(`/api/v1/pigfarm/heatLamp/group?unitId={unit.id}`);
332
+ },
333
+ deleteGroup: async (id: any): Promise<any> => {
334
+ var axios = await this.context.ready;
335
+ return axios.post(`/api/v1/pigfarm/heatLamp/deleteGroup?id=${id}`);
336
+ },
328
337
  switchByUnit: async (unit: Unit, action: "on" | "off", ids: Number[] | null = null): Promise<any> => {
329
338
  var axios = await this.context.ready;
330
339
  var args: {
package/unit_gateway.ts CHANGED
@@ -7,7 +7,7 @@ export class UnitGateway extends Object {
7
7
  this.context = context;
8
8
  }
9
9
 
10
- get(id: number|string) {
10
+ get(id: number | string) {
11
11
  return this.context.ready.then((axios) => {
12
12
  return axios.get(`/api/v1/unit/${id}`);
13
13
  });
@@ -123,20 +123,30 @@ export class UnitGateway extends Object {
123
123
  });
124
124
  },
125
125
  //创建批次,和bind可以复用
126
- create: (args:any) => {
126
+ create: (args: any) => {
127
127
  return this.context.ready.then((axios) => {
128
128
  return axios.post(`/api/v2/batch/unit/bind`, args);
129
129
  });
130
130
  },
131
- update: (args:any) => {
131
+ //获得绑定在某个批次的某个类别的单元信息,当前支持温度补偿信息
132
+ info: (id: any, type: 'tempCompensation') => {
133
+ return this.context.ready.then((axios) => {
134
+ return axios.get(`/api/v2/batch/unit/bind/${id}`, {
135
+ params: {
136
+ type
137
+ }
138
+ });
139
+ });
140
+ },
141
+ update: (args: any) => {
132
142
  return this.context.ready.then((axios) => {
133
143
  return axios.post(`/api/v2/batch/unit/update`, args);
134
144
  });
135
145
  },
136
- clear: (args:any) => {
146
+ clear: (args: any) => {
137
147
  return this.context.ready.then((axios) => {
138
148
  return axios.post(
139
- `/api/v2/batch/unit/empty`,args);
149
+ `/api/v2/batch/unit/empty`, args);
140
150
  });
141
151
  },
142
152
  //获取某个批次的所有单元信息
@@ -153,17 +163,17 @@ export class UnitGateway extends Object {
153
163
  });
154
164
  },
155
165
  //查询某个单元的所有批次信息
156
- searchInUnit: (unitId: Number,args :any) => {
166
+ searchInUnit: (unitId: Number, args: any) => {
157
167
  return this.context.ready.then((axios) => {
158
- return axios.post(`/api/v2/batch/${unitId}?`,args);
168
+ return axios.post(`/api/v2/batch/${unitId}?`, args);
159
169
  });
160
170
  },
161
171
  list: (unitIds: Number[]) => {
162
172
  return this.context.ready.then((axios) => {
163
173
  return axios.post(
164
- `/api/v2/batch/unit/getUnitBatchs`,{
165
- unitIds
166
- });
174
+ `/api/v2/batch/unit/getUnitBatchs`, {
175
+ unitIds
176
+ });
167
177
  });
168
178
  },
169
179
  // 获取批次操作记录