@cpzxrobot/sdk 1.0.99 → 1.1.0
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 +15 -0
- package/dist/car_gateway.js +15 -0
- package/dist/index.js +2 -0
- package/dist/user_gateway.js +8 -0
- package/index.ts +2 -0
- package/package.json +1 -1
- package/user_gateway.ts +10 -0
package/car_gateway.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Cpzxrobot, Device, Unit } from ".";
|
|
2
|
+
|
|
3
|
+
export class CarGateway extends Object {
|
|
4
|
+
context: Cpzxrobot;
|
|
5
|
+
constructor(context: Cpzxrobot) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
weightRecords(car: Device,date: Date) {
|
|
11
|
+
return this.context.axios
|
|
12
|
+
.get(`/api/v2/car/${car.id}/weightRecords?date=`+date.toISOString())
|
|
13
|
+
.then((res) => res.data);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CarGateway = void 0;
|
|
4
|
+
class CarGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
weightRecords(car, date) {
|
|
10
|
+
return this.context.axios
|
|
11
|
+
.get(`/api/v2/car/${car.id}/weightRecords?date=` + date.toISOString())
|
|
12
|
+
.then((res) => res.data);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.CarGateway = CarGateway;
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ 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
18
|
const chickenfarm_gateway_1 = require("./chickenfarm_gateway");
|
|
19
|
+
const car_gateway_1 = require("./car_gateway");
|
|
19
20
|
class Cpzxrobot {
|
|
20
21
|
constructor(appCode) {
|
|
21
22
|
this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
|
|
@@ -24,6 +25,7 @@ class Cpzxrobot {
|
|
|
24
25
|
this.mode = "dev";
|
|
25
26
|
this.auth = "";
|
|
26
27
|
this.token = "";
|
|
28
|
+
this.car = new car_gateway_1.CarGateway(this);
|
|
27
29
|
//获取当前浏览器的域名
|
|
28
30
|
this.ready = new Promise((resolve, reject) => {
|
|
29
31
|
this.resolveReady = resolve;
|
package/dist/user_gateway.js
CHANGED
|
@@ -107,6 +107,14 @@ 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 roles() {
|
|
111
|
+
var axios = await this.context.ready;
|
|
112
|
+
return axios.get("/api/v2/user/role/list");
|
|
113
|
+
}
|
|
114
|
+
async mypermission() {
|
|
115
|
+
var axios = await this.context.ready;
|
|
116
|
+
return axios.get("/api/v2/user/role/mypermission");
|
|
117
|
+
}
|
|
110
118
|
async delete(id) {
|
|
111
119
|
var axios = await this.context.ready;
|
|
112
120
|
return axios.post("/api/v2/user/delete?id=" + id);
|
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { PigfarmGateway } from "./pigfarm_gateway";
|
|
|
11
11
|
import { Device, Factory, MyAxiosInstance, Unit } from "./types";
|
|
12
12
|
import { UnitGateway } from "./unit_gateway";
|
|
13
13
|
import { ChickenFarmGateway } from "./chickenfarm_gateway";
|
|
14
|
+
import { CarGateway } from "./car_gateway";
|
|
14
15
|
|
|
15
16
|
export class Cpzxrobot {
|
|
16
17
|
device: DeviceGateway;
|
|
@@ -43,6 +44,7 @@ export class Cpzxrobot {
|
|
|
43
44
|
energy: EnergyGateway;
|
|
44
45
|
camera: CameraGateway;
|
|
45
46
|
unit: UnitGateway;
|
|
47
|
+
car: CarGateway = new CarGateway(this);
|
|
46
48
|
|
|
47
49
|
constructor(appCode: string) {
|
|
48
50
|
//获取当前浏览器的域名
|
package/package.json
CHANGED
package/user_gateway.ts
CHANGED
|
@@ -116,6 +116,16 @@ export class UserGateway extends Object {
|
|
|
116
116
|
return axios.get("/api/v2/user/list/" + factory.id);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
async roles() {
|
|
120
|
+
var axios = await this.context.ready;
|
|
121
|
+
return axios.get("/api/v2/user/role/list");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async mypermission() {
|
|
125
|
+
var axios = await this.context.ready;
|
|
126
|
+
return axios.get("/api/v2/user/role/mypermission");
|
|
127
|
+
}
|
|
128
|
+
|
|
119
129
|
async delete(id: number) {
|
|
120
130
|
var axios = await this.context.ready;
|
|
121
131
|
return axios.post("/api/v2/user/delete?id=" + id);
|