@cpzxrobot/sdk 1.0.22 → 1.0.23
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 +28 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +48 -0
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -18,5 +18,33 @@ class PigfarmGateway extends Object {
|
|
|
18
18
|
return axios.get(`/api/v1/pigfarm/pigcount/${unit.id}`);
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
//获得当日统计
|
|
22
|
+
dailyReportForUnit(unit, type) {
|
|
23
|
+
return this.context.ready.then((axios) => {
|
|
24
|
+
return axios.post(`/api/v1/pigfarm/today/${unit.id}`, {
|
|
25
|
+
type
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//获得周/月/季度统计
|
|
30
|
+
periodReportForUnit(unit, time, type) {
|
|
31
|
+
return this.context.ready.then((axios) => {
|
|
32
|
+
return axios.post(`/api/v1/pigfarm/statistics/${unit.id}`, {
|
|
33
|
+
time: time,
|
|
34
|
+
type: type
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//获得周期时间内的峰谷平能耗统计
|
|
39
|
+
peakValleyForUnit(unit, start, end) {
|
|
40
|
+
return this.context.ready.then((axios) => {
|
|
41
|
+
return axios.post(`/api/v1/pigfarm/electric/${unit.id}`, {
|
|
42
|
+
params: {
|
|
43
|
+
start: start,
|
|
44
|
+
end: end
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
}
|
|
21
49
|
}
|
|
22
50
|
exports.PigfarmGateway = PigfarmGateway;
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -19,4 +19,52 @@ export class PigfarmGateway extends Object {
|
|
|
19
19
|
return axios.get(`/api/v1/pigfarm/pigcount/${unit.id}`);
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
//获得当日统计
|
|
24
|
+
dailyReportForUnit(
|
|
25
|
+
unit: Unit,
|
|
26
|
+
type:
|
|
27
|
+
| "feed"
|
|
28
|
+
| "water"
|
|
29
|
+
| "electric"
|
|
30
|
+
) {
|
|
31
|
+
return this.context.ready.then((axios) => {
|
|
32
|
+
return axios.post(`/api/v1/pigfarm/today/${unit.id}`,{
|
|
33
|
+
type
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//获得周/月/季度统计
|
|
39
|
+
periodReportForUnit(
|
|
40
|
+
unit: Unit,
|
|
41
|
+
time: "week" | "month" | "season",
|
|
42
|
+
type:
|
|
43
|
+
| "feed"
|
|
44
|
+
| "water"
|
|
45
|
+
| "electric"
|
|
46
|
+
) {
|
|
47
|
+
return this.context.ready.then((axios) => {
|
|
48
|
+
return axios.post(`/api/v1/pigfarm/statistics/${unit.id}`,{
|
|
49
|
+
time: time,
|
|
50
|
+
type: type
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//获得周期时间内的峰谷平能耗统计
|
|
56
|
+
peakValleyForUnit(
|
|
57
|
+
unit: Unit,
|
|
58
|
+
start: string,
|
|
59
|
+
end: string
|
|
60
|
+
) {
|
|
61
|
+
return this.context.ready.then((axios) => {
|
|
62
|
+
return axios.post(`/api/v1/pigfarm/electric/${unit.id}`,{
|
|
63
|
+
params: {
|
|
64
|
+
start: start,
|
|
65
|
+
end: end
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
22
70
|
}
|