@cpzxrobot/sdk 1.3.52 → 1.3.54

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/car_gateway.ts CHANGED
@@ -21,7 +21,7 @@ export class CarGateway extends Object {
21
21
  .then((res) => res.data);
22
22
  }
23
23
 
24
- async cars(factory: Factory, date: Date) {
24
+ async cars(factory: Factory) {
25
25
  var axios = await this.context.ready;
26
26
  return axios
27
27
  .get(`/api/v2/car/${factory.pid}/cars`)
package/device_filter.ts CHANGED
@@ -208,12 +208,11 @@ export abstract class DeviceFilter<T extends { id: number }> {
208
208
  if (args.type == "raw") {
209
209
  return res;
210
210
  } else {
211
- if (res.data) {
212
- throw "device_list error("+JSON.stringify(res)+")";
211
+ if (!res.data) {
212
+ throw "device_list error(" + JSON.stringify(res) + ")";
213
213
  } else if (res.data.Error) {
214
214
  throw res.data.Error;
215
215
  }
216
- // this.devices.push(res.data);
217
216
  return res.data;
218
217
  }
219
218
  });
@@ -386,7 +385,9 @@ export abstract class DeviceFilter<T extends { id: number }> {
386
385
  });
387
386
  })
388
387
  .then((res) => {
389
- if (res.data.Error) {
388
+ if (!res.data) {
389
+ throw "device_list error(" + JSON.stringify(res) + ")";
390
+ } else if (res.data.Error) {
390
391
  throw res.data.Error;
391
392
  } else {
392
393
  return this.wrapList(res.data);
@@ -18,7 +18,7 @@ class CarGateway extends Object {
18
18
  .get(`/api/v2/car/${factory.pid}/detections?date=` + date.toISOString())
19
19
  .then((res) => res.data);
20
20
  }
21
- async cars(factory, date) {
21
+ async cars(factory) {
22
22
  var axios = await this.context.ready;
23
23
  return axios
24
24
  .get(`/api/v2/car/${factory.pid}/cars`)
@@ -189,13 +189,12 @@ class DeviceFilter {
189
189
  return res;
190
190
  }
191
191
  else {
192
- if (res.data) {
192
+ if (!res.data) {
193
193
  throw "device_list error(" + JSON.stringify(res) + ")";
194
194
  }
195
195
  else if (res.data.Error) {
196
196
  throw res.data.Error;
197
197
  }
198
- // this.devices.push(res.data);
199
198
  return res.data;
200
199
  }
201
200
  });
@@ -331,7 +330,10 @@ class DeviceFilter {
331
330
  });
332
331
  })
333
332
  .then((res) => {
334
- if (res.data.Error) {
333
+ if (!res.data) {
334
+ throw "device_list error(" + JSON.stringify(res) + ")";
335
+ }
336
+ else if (res.data.Error) {
335
337
  throw res.data.Error;
336
338
  }
337
339
  else {
@@ -107,7 +107,7 @@ class ProductGateway extends Object {
107
107
  * @param file 上传的Excel文件
108
108
  * @returns Promise
109
109
  */
110
- import(file) {
110
+ import() {
111
111
  return this.context.ready.then((axios) => {
112
112
  return axios.upload(`/api/v2/coremde-sale/product/import`);
113
113
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.3.52",
3
+ "version": "1.3.54",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -186,7 +186,7 @@ export class ProductGateway extends Object {
186
186
  * @param file 上传的Excel文件
187
187
  * @returns Promise
188
188
  */
189
- import(file: File) {
189
+ import() {
190
190
  return this.context.ready.then((axios) => {
191
191
  return axios.upload(`/api/v2/coremde-sale/product/import`);
192
192
  });
package/user_gateway.ts CHANGED
@@ -62,7 +62,7 @@ export class UserGateway extends Object {
62
62
  }
63
63
  } else {
64
64
  var selectedFarm = await this.context.user.getSelectedFarm()
65
- factoryId = selectedFarm.id
65
+ factoryId = selectedFarm.id as number
66
66
  }
67
67
  return this.context.ready.then((axios) => {
68
68
  return axios.get(`/api/v2/user/list/${factoryId}`)