@cpzxrobot/sdk 1.0.31 → 1.0.32
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/factory_gateway.js +7 -1
- package/dist/index.js +4 -1
- package/factory_gateway.ts +7 -1
- package/index.ts +4 -1
- package/package.json +1 -1
- package/types.d.ts +1 -0
package/dist/factory_gateway.js
CHANGED
|
@@ -46,9 +46,15 @@ class FactoryGateway extends Object {
|
|
|
46
46
|
const response = await axios.get(`/api/v1/factory/${data.id}/organizaion`, data);
|
|
47
47
|
return response.data;
|
|
48
48
|
}
|
|
49
|
-
//支持以下三个name:'capacity'(规模),'used_capacity'(存栏量),'workshop_count'(栋舍/车间数量),'manager'(负责人)
|
|
49
|
+
//支持以下三个name:'capacity'(规模),'used_capacity'(存栏量),'workshop_count'(栋舍/车间数量),'manager'(负责人),'electric'/'water'/'feed' (电耗/水耗/饲料耗)
|
|
50
50
|
async entry(factory, name) {
|
|
51
51
|
var axios = await this.context.ready;
|
|
52
|
+
if (['electric', 'water', 'feed'].includes(name)) {
|
|
53
|
+
const response = await axios.post(`/api/v1/pigfarm/consumption/${factory.id}`, {
|
|
54
|
+
type: name
|
|
55
|
+
});
|
|
56
|
+
return response.data;
|
|
57
|
+
}
|
|
52
58
|
const response = await axios.get(`/api/v1/factory/${factory.id}/entry/${name}`);
|
|
53
59
|
return response.data;
|
|
54
60
|
}
|
package/dist/index.js
CHANGED
|
@@ -200,6 +200,9 @@ class Cpzxrobot {
|
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
+
dict(dictName) {
|
|
204
|
+
return this.axios.get(`/api/v1/dict/${dictName}`);
|
|
205
|
+
}
|
|
203
206
|
//打开其他小程序
|
|
204
207
|
openMiniApp(url) {
|
|
205
208
|
this._jumpToMiniApp(url);
|
|
@@ -218,7 +221,7 @@ class Cpzxrobot {
|
|
|
218
221
|
const token = localStorage.getItem("token");
|
|
219
222
|
if (token) {
|
|
220
223
|
this.token = token;
|
|
221
|
-
this.initAxios(
|
|
224
|
+
this.initAxios("https://www.cpzxrobot.com/");
|
|
222
225
|
this.resolveReady(this.axios);
|
|
223
226
|
return;
|
|
224
227
|
}
|
package/factory_gateway.ts
CHANGED
|
@@ -52,9 +52,15 @@ export class FactoryGateway extends Object {
|
|
|
52
52
|
return response.data;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
//支持以下三个name:'capacity'(规模),'used_capacity'(存栏量),'workshop_count'(栋舍/车间数量),'manager'(负责人)
|
|
55
|
+
//支持以下三个name:'capacity'(规模),'used_capacity'(存栏量),'workshop_count'(栋舍/车间数量),'manager'(负责人),'electric'/'water'/'feed' (电耗/水耗/饲料耗)
|
|
56
56
|
async entry(factory:Factory,name:string): Promise<any> {
|
|
57
57
|
var axios = await this.context.ready;
|
|
58
|
+
if (['electric','water','feed'].includes(name)) {
|
|
59
|
+
const response = await axios.post(`/api/v1/pigfarm/consumption/${factory.id}`,{
|
|
60
|
+
type:name
|
|
61
|
+
});
|
|
62
|
+
return response.data;
|
|
63
|
+
}
|
|
58
64
|
const response = await axios.get(`/api/v1/factory/${factory.id}/entry/${name}`);
|
|
59
65
|
return response.data;
|
|
60
66
|
}
|
package/index.ts
CHANGED
|
@@ -234,6 +234,9 @@ export class Cpzxrobot {
|
|
|
234
234
|
break;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
+
dict(dictName: string) {
|
|
238
|
+
return this.axios.get(`/api/v1/dict/${dictName}`);
|
|
239
|
+
}
|
|
237
240
|
|
|
238
241
|
//打开其他小程序
|
|
239
242
|
openMiniApp(url: string) {
|
|
@@ -253,7 +256,7 @@ export class Cpzxrobot {
|
|
|
253
256
|
const token = localStorage.getItem("token");
|
|
254
257
|
if (token) {
|
|
255
258
|
this.token = token;
|
|
256
|
-
this.initAxios(
|
|
259
|
+
this.initAxios("https://www.cpzxrobot.com/");
|
|
257
260
|
this.resolveReady(this.axios);
|
|
258
261
|
return;
|
|
259
262
|
} else {
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -148,6 +148,7 @@ export class Cpzxrobot {
|
|
|
148
148
|
axios: MyAxiosInstance;
|
|
149
149
|
camera: CameraGateway;
|
|
150
150
|
pigfarm: PigfarmGateway;
|
|
151
|
+
dict: (key: string) => any;
|
|
151
152
|
_getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
152
153
|
_getSelectedUnitFromMiniApp: () => Promise<Unit>;
|
|
153
154
|
openMiniApp: (url: string) => void;
|