@cpzxrobot/sdk 1.1.25 → 1.1.27
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/dist/pigfarm_gateway.js +9 -5
- package/package.json +1 -1
- package/pigfarm_gateway.ts +15 -5
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -259,15 +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
|
-
updateByUnit: async (unit, lamp) => {
|
|
262
|
+
updateByUnit: async (unit, lamp, ids = null) => {
|
|
263
263
|
var axios = await this.context.ready;
|
|
264
|
-
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, lamp);
|
|
264
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, Object.assign(Object.assign({}, lamp), { ids }));
|
|
265
265
|
},
|
|
266
|
-
switchByUnit: async (unit, action) => {
|
|
266
|
+
switchByUnit: async (unit, action, ids = null) => {
|
|
267
267
|
var axios = await this.context.ready;
|
|
268
|
-
|
|
268
|
+
var args = {
|
|
269
269
|
action,
|
|
270
|
-
}
|
|
270
|
+
};
|
|
271
|
+
if (ids) {
|
|
272
|
+
args["ids"] = ids;
|
|
273
|
+
}
|
|
274
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/switch`, args);
|
|
271
275
|
},
|
|
272
276
|
taskStatus: async (args) => {
|
|
273
277
|
var axios = await this.context.ready;
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -318,15 +318,25 @@ 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
|
-
updateByUnit: async (unit: Unit,lamp: HeatLamp): Promise<any> => {
|
|
321
|
+
updateByUnit: async (unit: Unit,lamp: HeatLamp,ids:Number[]|null = null): Promise<any> => {
|
|
322
322
|
var axios = await this.context.ready;
|
|
323
|
-
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`,
|
|
323
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/update`, {
|
|
324
|
+
...lamp,
|
|
325
|
+
ids
|
|
326
|
+
});
|
|
324
327
|
},
|
|
325
|
-
switchByUnit: async (unit: Unit, action: "on" | "off"): Promise<any> => {
|
|
328
|
+
switchByUnit: async (unit: Unit, action: "on" | "off",ids:Number[]|null = null): Promise<any> => {
|
|
326
329
|
var axios = await this.context.ready;
|
|
327
|
-
|
|
330
|
+
var args:{
|
|
331
|
+
action: "on" | "off",
|
|
332
|
+
ids?:Number[]
|
|
333
|
+
} = {
|
|
328
334
|
action,
|
|
329
|
-
}
|
|
335
|
+
}
|
|
336
|
+
if (ids) {
|
|
337
|
+
args["ids"] = ids;
|
|
338
|
+
}
|
|
339
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/${unit.id}/switch`, args);
|
|
330
340
|
},
|
|
331
341
|
taskStatus: async (args:{
|
|
332
342
|
id?:number,
|