@cpzxrobot/sdk 1.0.43 → 1.0.44
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 +8 -0
- package/dist/transport_gateway.js +1 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +17 -7
- package/transport_gateway.ts +2 -0
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -63,6 +63,14 @@ class PigfarmGateway extends Object {
|
|
|
63
63
|
var axios = await this.context.ready;
|
|
64
64
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
|
|
65
65
|
},
|
|
66
|
+
control: async (lamp, action) => {
|
|
67
|
+
var axios = await this.context.ready;
|
|
68
|
+
var id = typeof lamp === "number" ? lamp : lamp.id;
|
|
69
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/control`, {
|
|
70
|
+
id,
|
|
71
|
+
action,
|
|
72
|
+
});
|
|
73
|
+
},
|
|
66
74
|
};
|
|
67
75
|
}
|
|
68
76
|
}
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -55,7 +55,7 @@ export class PigfarmGateway extends Object {
|
|
|
55
55
|
|
|
56
56
|
get heatlamp() {
|
|
57
57
|
return {
|
|
58
|
-
add: (unit:Unit, data: HeatLamp) => {
|
|
58
|
+
add: (unit: Unit, data: HeatLamp) => {
|
|
59
59
|
return this.context.ready.then((axios) => {
|
|
60
60
|
return axios.post(`/api/v1/pigfarm/heatLamp/config/add`, {
|
|
61
61
|
...data,
|
|
@@ -63,17 +63,27 @@ export class PigfarmGateway extends Object {
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
|
-
list: async (unit:Unit):Promise<any
|
|
66
|
+
list: async (unit: Unit): Promise<any> => {
|
|
67
67
|
var axios = await this.context.ready;
|
|
68
|
-
return axios.post(
|
|
68
|
+
return axios.post(
|
|
69
|
+
`/api/v1/pigfarm/heatLamp/config/list?unitId=${unit.id}`
|
|
70
|
+
);
|
|
69
71
|
},
|
|
70
|
-
get: async (id: number):Promise<any
|
|
72
|
+
get: async (id: number): Promise<any> => {
|
|
71
73
|
var axios = await this.context.ready;
|
|
72
|
-
return axios.get(`/api/v1/pigfarm/heatLamp/config/${id}`)
|
|
74
|
+
return axios.get(`/api/v1/pigfarm/heatLamp/config/${id}`);
|
|
73
75
|
},
|
|
74
|
-
update:async (lamp: HeatLamp):Promise<any
|
|
76
|
+
update: async (lamp: HeatLamp): Promise<any> => {
|
|
75
77
|
var axios = await this.context.ready;
|
|
76
|
-
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`,lamp)
|
|
78
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/config/update`, lamp);
|
|
79
|
+
},
|
|
80
|
+
control: async (lamp: HeatLamp | number, action: "on" | "off") => {
|
|
81
|
+
var axios = await this.context.ready;
|
|
82
|
+
var id = typeof lamp === "number" ? lamp : lamp.id;
|
|
83
|
+
return axios.post(`/api/v1/pigfarm/heatLamp/control`, {
|
|
84
|
+
id,
|
|
85
|
+
action,
|
|
86
|
+
});
|
|
77
87
|
},
|
|
78
88
|
};
|
|
79
89
|
}
|
package/transport_gateway.ts
CHANGED
|
@@ -19,11 +19,13 @@ export class TransportGateway extends Object {
|
|
|
19
19
|
pageSize: number;
|
|
20
20
|
deviceId: number | undefined;
|
|
21
21
|
unitId: number | undefined;
|
|
22
|
+
factoryId: number | undefined;
|
|
22
23
|
} = {
|
|
23
24
|
current: 1,
|
|
24
25
|
pageSize: 10,
|
|
25
26
|
deviceId: id,
|
|
26
27
|
unitId: undefined,
|
|
28
|
+
factoryId: undefined,
|
|
27
29
|
}
|
|
28
30
|
): Promise<FodderOrder[]> => {
|
|
29
31
|
return this.context.ready.then(() => {
|