@cpzxrobot/sdk 1.0.31 → 1.0.33

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.
@@ -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(baseURL);
224
+ this.initAxios("https://www.cpzxrobot.com/");
222
225
  this.resolveReady(this.axios);
223
226
  return;
224
227
  }
@@ -14,6 +14,7 @@ class TransportGateway extends Object {
14
14
  current: 1,
15
15
  pageSize: 10,
16
16
  deviceId: id,
17
+ unitId: undefined,
17
18
  }) => {
18
19
  return this.context.ready.then(() => {
19
20
  return this.context.axios
@@ -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(baseURL);
259
+ this.initAxios("https://www.cpzxrobot.com/");
257
260
  this.resolveReady(this.axios);
258
261
  return;
259
262
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -18,10 +18,12 @@ export class TransportGateway extends Object {
18
18
  current: number;
19
19
  pageSize: number;
20
20
  deviceId: number | undefined;
21
+ unitId: number | undefined;
21
22
  } = {
22
23
  current: 1,
23
24
  pageSize: 10,
24
25
  deviceId: id,
26
+ unitId: undefined,
25
27
  }
26
28
  ): Promise<FodderOrder[]> => {
27
29
  return this.context.ready.then(() => {
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;