@cpzxrobot/sdk 1.0.93 → 1.0.95

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.
@@ -0,0 +1,30 @@
1
+ import {
2
+ Cpzxrobot,
3
+ DeviceConfig,
4
+ Factory,
5
+ HeatLamp,
6
+ Unit,
7
+ WeightMeter,
8
+ WeightMeterSensor,
9
+ weightMeterSensorsConfig,
10
+ } from "./types";
11
+
12
+ export class ChickenFarmGateway extends Object {
13
+ context: Cpzxrobot;
14
+ constructor(context: Cpzxrobot) {
15
+ super();
16
+ this.context = context;
17
+ }
18
+ //获得日龄
19
+ get deadDetection() {
20
+ return {
21
+ by_factory: async (factory: Factory, status = "running") => {
22
+ return this.context.ready.then((axios) => {
23
+ return axios.get(
24
+ `api/v2/diedchicken/task/factory=${factory.id}/status=${status}`
25
+ );
26
+ });
27
+ },
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChickenFarmGateway = void 0;
4
+ class ChickenFarmGateway extends Object {
5
+ constructor(context) {
6
+ super();
7
+ this.context = context;
8
+ }
9
+ //获得日龄
10
+ get deadDetection() {
11
+ return {
12
+ by_factory: async (factory, status = "running") => {
13
+ return this.context.ready.then((axios) => {
14
+ return axios.get(`api/v2/diedchicken/task/factory=${factory.id}/status=${status}`);
15
+ });
16
+ },
17
+ };
18
+ }
19
+ }
20
+ exports.ChickenFarmGateway = ChickenFarmGateway;
package/dist/index.js CHANGED
@@ -15,9 +15,11 @@ const energy_gateway_1 = require("./energy_gateway");
15
15
  const camera_gateway_1 = require("./camera_gateway");
16
16
  const pigfarm_gateway_1 = require("./pigfarm_gateway");
17
17
  const unit_gateway_1 = require("./unit_gateway");
18
+ const chickenfarm_gateway_1 = require("./chickenfarm_gateway");
18
19
  class Cpzxrobot {
19
20
  constructor(appCode) {
20
21
  this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
22
+ this.chickenfarm = new chickenfarm_gateway_1.ChickenFarmGateway(this);
21
23
  this.hash = "shzx";
22
24
  this.mode = "dev";
23
25
  this.auth = "";
@@ -107,5 +107,13 @@ class UserGateway extends Object {
107
107
  var axios = await this.context.ready;
108
108
  return axios.get("/api/v2/user/list/" + factory.id);
109
109
  }
110
+ async delete(id) {
111
+ var axios = await this.context.ready;
112
+ return axios.post("/api/v2/user/delete?id=" + id);
113
+ }
114
+ async avatar(id, avatar) {
115
+ var axios = await this.context.ready;
116
+ return axios.post(`/api/v2/user/${id}/avatar/add`, avatar);
117
+ }
110
118
  }
111
119
  exports.UserGateway = UserGateway;
package/index.ts CHANGED
@@ -10,10 +10,12 @@ import { type ElectricMeterRate } from "./energy_types/electric_meter_gateway";
10
10
  import { PigfarmGateway } from "./pigfarm_gateway";
11
11
  import { Device, Factory, MyAxiosInstance, Unit } from "./types";
12
12
  import { UnitGateway } from "./unit_gateway";
13
+ import { ChickenFarmGateway } from "./chickenfarm_gateway";
13
14
 
14
15
  export class Cpzxrobot {
15
16
  device: DeviceGateway;
16
17
  pigfarm: PigfarmGateway = new PigfarmGateway(this);
18
+ chickenfarm: ChickenFarmGateway = new ChickenFarmGateway(this);
17
19
  public hash = "shzx";
18
20
  mode: string = "dev";
19
21
  auth: string = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/user_gateway.ts CHANGED
@@ -111,8 +111,18 @@ export class UserGateway extends Object {
111
111
  return axios.post("/api/v2/user", user);
112
112
  }
113
113
 
114
- async list(factory:Factory) {
114
+ async list(factory: Factory) {
115
115
  var axios = await this.context.ready;
116
116
  return axios.get("/api/v2/user/list/" + factory.id);
117
117
  }
118
+
119
+ async delete(id: number) {
120
+ var axios = await this.context.ready;
121
+ return axios.post("/api/v2/user/delete?id=" + id);
122
+ }
123
+
124
+ async avatar(id: number, avatar: FormData) {
125
+ var axios = await this.context.ready;
126
+ return axios.post(`/api/v2/user/${id}/avatar/add`, avatar);
127
+ }
118
128
  }