@cpzxrobot/sdk 1.1.99 → 1.2.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/dist/index.js +2 -0
- package/dist/robot_gateway.js +20 -0
- package/index.ts +2 -0
- package/package.json +1 -1
- package/readme.md +2 -0
- package/robot_gateway.ts +23 -0
- package/types.d.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ const customer_gateway_1 = require("./customer_gateway");
|
|
|
24
24
|
const company_gateway_1 = require("./company_gateway");
|
|
25
25
|
const news_gateway_1 = require("./news_gateway");
|
|
26
26
|
const logs_gateway_1 = require("./logs_gateway");
|
|
27
|
+
const robot_gateway_1 = require("./robot_gateway");
|
|
27
28
|
class Cpzxrobot {
|
|
28
29
|
constructor(appCode) {
|
|
29
30
|
this.pigfarm = new pigfarm_gateway_1.PigfarmGateway(this);
|
|
@@ -40,6 +41,7 @@ class Cpzxrobot {
|
|
|
40
41
|
this.company = new company_gateway_1.CompanyGateway(this);
|
|
41
42
|
this.news = new news_gateway_1.NewsGateway(this);
|
|
42
43
|
this.logs = new logs_gateway_1.LogsGateway(this);
|
|
44
|
+
this.robot = new robot_gateway_1.RobotGateway(this);
|
|
43
45
|
//获取当前浏览器的域名
|
|
44
46
|
this.ready = new Promise((resolve, reject) => {
|
|
45
47
|
this.resolveReady = resolve;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RobotGateway = void 0;
|
|
4
|
+
class RobotGateway extends Object {
|
|
5
|
+
constructor(context) {
|
|
6
|
+
super();
|
|
7
|
+
this.context = context;
|
|
8
|
+
}
|
|
9
|
+
async cage(unitId) {
|
|
10
|
+
///api/v2/robot/getCageList/{unitId}
|
|
11
|
+
var axios = await this.context.ready;
|
|
12
|
+
return axios.get(`/api/v2/robot/getCageList/${unitId}`);
|
|
13
|
+
}
|
|
14
|
+
async alarm(unitId) {
|
|
15
|
+
///api/v2/robot/getAlarmList/{unitId}
|
|
16
|
+
var axios = await this.context.ready;
|
|
17
|
+
return axios.get(`/api/v2/robot/getAlarmList/${unitId}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.RobotGateway = RobotGateway;
|
package/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { CustomerGateway } from "./customer_gateway";
|
|
|
19
19
|
import { CompanyGateway } from "./company_gateway";
|
|
20
20
|
import { NewsGateway } from "./news_gateway";
|
|
21
21
|
import { LogsGateway } from "./logs_gateway";
|
|
22
|
+
import { RobotGateway } from "./robot_gateway";
|
|
22
23
|
|
|
23
24
|
export class Cpzxrobot {
|
|
24
25
|
device: DeviceGateway;
|
|
@@ -64,6 +65,7 @@ export class Cpzxrobot {
|
|
|
64
65
|
company: CompanyGateway = new CompanyGateway(this);
|
|
65
66
|
news: NewsGateway = new NewsGateway(this);
|
|
66
67
|
logs: LogsGateway = new LogsGateway(this);
|
|
68
|
+
robot: RobotGateway = new RobotGateway(this);
|
|
67
69
|
|
|
68
70
|
|
|
69
71
|
constructor(appCode: string) {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -244,6 +244,8 @@ baseURL: "/"
|
|
|
244
244
|
| cpzxrobot().news.alarm.list | 获得报警列表,传入必要的分页参数 |
|
|
245
245
|
| cpzxrobot().getGeo | 获得地理位置信息 |
|
|
246
246
|
| cpzxrobot().logs.operations | 获得操作日志列表,传入必要的参数 |
|
|
247
|
+
| cpzxrobot().robot.cage | 获得栏位信息 |
|
|
248
|
+
| cpzxrobot().robot.alarm | 获得报警信息,传入必要的参数 |
|
|
247
249
|
|
|
248
250
|
### 工厂信息接口
|
|
249
251
|
|
package/robot_gateway.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Cpzxrobot, Factory, Unit } from "./types";
|
|
2
|
+
|
|
3
|
+
export class RobotGateway extends Object {
|
|
4
|
+
context: Cpzxrobot;
|
|
5
|
+
|
|
6
|
+
constructor(context: Cpzxrobot) {
|
|
7
|
+
super();
|
|
8
|
+
this.context = context;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async cage(unitId: number){
|
|
12
|
+
///api/v2/robot/getCageList/{unitId}
|
|
13
|
+
var axios = await this.context.ready;
|
|
14
|
+
return axios.get(`/api/v2/robot/getCageList/${unitId}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async alarm(unitId: number){
|
|
18
|
+
///api/v2/robot/getAlarmList/{unitId}
|
|
19
|
+
var axios = await this.context.ready;
|
|
20
|
+
return axios.get(`/api/v2/robot/getAlarmList/${unitId}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
package/types.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { ContractGateway } from "@cpzxrobot/sdk/contract_gateway";
|
|
|
14
14
|
import { CustomerGateway } from "@cpzxrobot/sdk/customer_gateway";
|
|
15
15
|
import { CompanyGateway } from "@cpzxrobot/sdk/company_gateway";
|
|
16
16
|
import { LogsGateway } from "@cpzxrobot/sdk/logs_gateway";
|
|
17
|
+
import { RobotGateway } from "@cpzxrobot/sdk/robot_gateway";
|
|
17
18
|
|
|
18
19
|
type Device = {
|
|
19
20
|
id: number;
|
|
@@ -331,6 +332,7 @@ class Cpzxrobot {
|
|
|
331
332
|
customer: CustomerGateway;
|
|
332
333
|
company: CompanyGateway;
|
|
333
334
|
logs: LogsGateway;
|
|
335
|
+
robot: RobotGateway;
|
|
334
336
|
dict: (key: string) => any;
|
|
335
337
|
_getSelectedFarmFromMiniApp: () => Promise<Factory>;
|
|
336
338
|
_getSelectedUnitFromMiniApp: () => Promise<Unit>;
|