@cpzxrobot/sdk 1.0.46 → 1.0.48

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.
@@ -77,6 +77,11 @@ class PigfarmGateway extends Object {
77
77
  var axios = await this.context.ready;
78
78
  return axios.post(`/api/v1/pigfarm/heatLamp/list/${unit.id}`);
79
79
  },
80
+ //返回物联网相关的字段
81
+ iotFields: async (lamp) => {
82
+ var axios = await this.context.ready;
83
+ return axios.post(`/api/v1/pigfarm/heatLamp/iotFields/${lamp.id}`);
84
+ },
80
85
  //开关,传入id或对象,action为on或off
81
86
  switch: async (lamp, action) => {
82
87
  var axios = await this.context.ready;
@@ -89,7 +94,7 @@ class PigfarmGateway extends Object {
89
94
  //设置,传入id或对象,action为dayage时需要传回设置的天数
90
95
  set: async (lamp, action, arg) => {
91
96
  var axios = await this.context.ready;
92
- var url = action === "dayage" ? "/api/v1/pigfarm/heatLamp/syncDayage" : "";
97
+ var url = action === "dayage" ? "/api/v1/pigfarm/heatLamp/syncDayage" : `/api/v1/pigfarm/heatLamp/config/set`;
93
98
  var id = typeof lamp === "number" ? lamp : lamp.id;
94
99
  var body = {
95
100
  id
@@ -98,7 +103,7 @@ class PigfarmGateway extends Object {
98
103
  case "dayage":
99
104
  body["days"] = arg;
100
105
  }
101
- return axios.post(`/api/v1/pigfarm/heatLamp/config/set`, lamp);
106
+ return axios.post(url, lamp);
102
107
  },
103
108
  get: async (id) => {
104
109
  var axios = await this.context.ready;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -93,6 +93,13 @@ export class PigfarmGateway extends Object {
93
93
  `/api/v1/pigfarm/heatLamp/list/${unit.id}`
94
94
  );
95
95
  },
96
+ //返回物联网相关的字段
97
+ iotFields: async (lamp: HeatLamp): Promise<any> => {
98
+ var axios = await this.context.ready;
99
+ return axios.post(
100
+ `/api/v1/pigfarm/heatLamp/iotFields/${lamp.id}`
101
+ );
102
+ },
96
103
  //开关,传入id或对象,action为on或off
97
104
  switch: async (lamp: HeatLamp | number, action: "on" | "off") => {
98
105
  var axios = await this.context.ready;
@@ -105,7 +112,7 @@ export class PigfarmGateway extends Object {
105
112
  //设置,传入id或对象,action为dayage时需要传回设置的天数
106
113
  set: async (lamp: HeatLamp, action: "dayage",arg: any): Promise<any> => {
107
114
  var axios = await this.context.ready;
108
- var url = action === "dayage" ? "/api/v1/pigfarm/heatLamp/syncDayage" : "";
115
+ var url = action === "dayage" ? "/api/v1/pigfarm/heatLamp/syncDayage" : `/api/v1/pigfarm/heatLamp/config/set`;
109
116
  var id = typeof lamp === "number" ? lamp : lamp.id;
110
117
  var body:{
111
118
  id: number,
@@ -117,7 +124,7 @@ export class PigfarmGateway extends Object {
117
124
  case "dayage":
118
125
  body["days"] = arg;
119
126
  }
120
- return axios.post(`/api/v1/pigfarm/heatLamp/config/set`, lamp);
127
+ return axios.post(url, lamp);
121
128
  },
122
129
  get: async (id: number): Promise<any> => {
123
130
  var axios = await this.context.ready;
package/readme.md CHANGED
@@ -86,6 +86,7 @@ baseURL: "/"
86
86
  | cpzxrobot().pigfarm.unitStat | 获得单元的统计信息,包括每日料耗,饲料消耗,日龄,存栏量等 |
87
87
  | cpzxrobot().pigfarm.heatlamp.set | 设置保温灯的当前工作日龄,调用时,action传"dayage",argc传天数 |
88
88
  | cpzxrobot().pigfarm.heatlamp.switch | 设置保温灯的当前工作日龄,调用时,action"on"或"off" |
89
+ | cpzxrobot().pigfarm.heatlamp.iotFields | 获取保温灯用于获取iot的字段列表 |
89
90
 
90
91
 
91
92
  ### 工厂信息接口