@cpzxrobot/sdk 1.1.16 → 1.1.18
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/device_type_gateway.ts +1 -1
- package/dist/device_type_gateway.js +1 -1
- package/dist/pigfarm_gateway.js +1 -1
- package/dist/user_gateway.js +49 -0
- package/package.json +1 -1
- package/pigfarm_gateway.ts +1 -1
- package/readme.md +4 -0
- package/user_gateway.ts +52 -1
package/device_type_gateway.ts
CHANGED
|
@@ -14,7 +14,7 @@ export class DeviceTypeGateway {
|
|
|
14
14
|
if (this.deviceTypes) {
|
|
15
15
|
return Promise.resolve(this.deviceTypes)
|
|
16
16
|
}
|
|
17
|
-
return this.context.axios.get('/api/
|
|
17
|
+
return this.context.axios.get('/api/v1/device/type')
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
alarmConfigForUnit(unit: Unit): Promise<any> {
|
|
@@ -10,7 +10,7 @@ class DeviceTypeGateway {
|
|
|
10
10
|
if (this.deviceTypes) {
|
|
11
11
|
return Promise.resolve(this.deviceTypes);
|
|
12
12
|
}
|
|
13
|
-
return this.context.axios.get('/api/
|
|
13
|
+
return this.context.axios.get('/api/v1/device/type');
|
|
14
14
|
}
|
|
15
15
|
alarmConfigForUnit(unit) {
|
|
16
16
|
return this.context.ready.then((axios) => {
|
package/dist/pigfarm_gateway.js
CHANGED
|
@@ -65,7 +65,7 @@ class PigfarmGateway extends Object {
|
|
|
65
65
|
//根据单元类型和传感器类型获取告警阈值曲线
|
|
66
66
|
threshold(data, sensorType) {
|
|
67
67
|
return this.context.ready.then((axios) => {
|
|
68
|
-
return axios.get(`/api/v1/pigfarm/alertThershold/${data.
|
|
68
|
+
return axios.get(`/api/v1/pigfarm/alertThershold/${data.id}/${sensorType}`, data);
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
get relay() {
|
package/dist/user_gateway.js
CHANGED
|
@@ -119,5 +119,54 @@ class UserGateway extends Object {
|
|
|
119
119
|
var axios = await this.context.ready;
|
|
120
120
|
return axios.post(`/api/v2/user/${id}/avatar/add`, avatar);
|
|
121
121
|
}
|
|
122
|
+
get approval() {
|
|
123
|
+
return {
|
|
124
|
+
count: (id, status) => {
|
|
125
|
+
return this.context.ready.then((axios) => {
|
|
126
|
+
return axios.post(`/api/v2/coremde-sale/approval/count`, {
|
|
127
|
+
status,
|
|
128
|
+
userId: id
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
list: (id, status) => {
|
|
133
|
+
return this.context.ready.then((axios) => {
|
|
134
|
+
return axios.post(`/api/v2/coremde-sale/approval/list`, {
|
|
135
|
+
status,
|
|
136
|
+
userId: id
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
get checkin() {
|
|
143
|
+
return {
|
|
144
|
+
add: (userId, address) => {
|
|
145
|
+
return this.context.ready.then((axios) => {
|
|
146
|
+
return axios.post(`/api/v2/coremde-sale/checkin/add`, {
|
|
147
|
+
userId,
|
|
148
|
+
address
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
//date 传入格式为2019-8或者Date类型对象
|
|
153
|
+
list: (userId, date) => {
|
|
154
|
+
//if date is string
|
|
155
|
+
var yearMonth;
|
|
156
|
+
if (typeof date === 'string') {
|
|
157
|
+
yearMonth = date;
|
|
158
|
+
}
|
|
159
|
+
else if (typeof date === 'object') {
|
|
160
|
+
yearMonth = date.getFullYear() + '-' + (date.getMonth() + 1);
|
|
161
|
+
}
|
|
162
|
+
return this.context.ready.then((axios) => {
|
|
163
|
+
return axios.post(`/api/v2/coremde-sale/checkin/list`, {
|
|
164
|
+
userId,
|
|
165
|
+
yearMonth
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
122
171
|
}
|
|
123
172
|
exports.UserGateway = UserGateway;
|
package/package.json
CHANGED
package/pigfarm_gateway.ts
CHANGED
|
@@ -85,7 +85,7 @@ export class PigfarmGateway extends Object {
|
|
|
85
85
|
threshold(data: Unit, sensorType: String) {
|
|
86
86
|
return this.context.ready.then((axios) => {
|
|
87
87
|
return axios.get(
|
|
88
|
-
`/api/v1/pigfarm/alertThershold/${data.
|
|
88
|
+
`/api/v1/pigfarm/alertThershold/${data.id}/${sensorType}`,
|
|
89
89
|
data
|
|
90
90
|
);
|
|
91
91
|
});
|
package/readme.md
CHANGED
|
@@ -139,6 +139,10 @@ baseURL: "/"
|
|
|
139
139
|
| cpzxrobot().user.add | 添加用户 |
|
|
140
140
|
| cpzxrobot().user.update | 更新用户 |
|
|
141
141
|
| cpzxrobot().user.list | 列出用户(传入工厂) |
|
|
142
|
+
| cpzxrobot().user.approval.list | 获取用户审批列表,传入userId和status参数 |
|
|
143
|
+
| cpzxrobot().user.approval.count | 获取用户审批列表的数量,传入userId和status参数 |
|
|
144
|
+
| cpzxrobot().user.checkin.add | 添加用户签到记录,传入userId和address参数 |
|
|
145
|
+
| cpzxrobot().user.checkin.list | 列出用户签到记录,传入userId和date参数 |
|
|
142
146
|
|
|
143
147
|
### 工厂信息接口
|
|
144
148
|
|
package/user_gateway.ts
CHANGED
|
@@ -113,7 +113,7 @@ export class UserGateway extends Object {
|
|
|
113
113
|
|
|
114
114
|
async list(factory: Factory) {
|
|
115
115
|
var axios = await this.context.ready;
|
|
116
|
-
return axios.get("/api/v2/" + factory.id+"/users");
|
|
116
|
+
return axios.get("/api/v2/" + factory.id + "/users");
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
async mypermission() {
|
|
@@ -130,4 +130,55 @@ export class UserGateway extends Object {
|
|
|
130
130
|
var axios = await this.context.ready;
|
|
131
131
|
return axios.post(`/api/v2/user/${id}/avatar/add`, avatar);
|
|
132
132
|
}
|
|
133
|
+
|
|
134
|
+
get approval() {
|
|
135
|
+
return {
|
|
136
|
+
count: (id: number, status: any) => {
|
|
137
|
+
return this.context.ready.then((axios) => {
|
|
138
|
+
return axios.post(`/api/v2/coremde-sale/approval/count`, {
|
|
139
|
+
status,
|
|
140
|
+
userId: id
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
list: (id: number, status: any) => {
|
|
145
|
+
return this.context.ready.then((axios) => {
|
|
146
|
+
return axios.post(`/api/v2/coremde-sale/approval/list`, {
|
|
147
|
+
status,
|
|
148
|
+
userId: id
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
get checkin() {
|
|
156
|
+
return {
|
|
157
|
+
add: (userId: number,address: String) => {
|
|
158
|
+
return this.context.ready.then((axios) => {
|
|
159
|
+
return axios.post(`/api/v2/coremde-sale/checkin/add`, {
|
|
160
|
+
userId,
|
|
161
|
+
address
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
//date 传入格式为2019-8或者Date类型对象
|
|
166
|
+
list: (userId: number,date:any) => {
|
|
167
|
+
//if date is string
|
|
168
|
+
var yearMonth:string;
|
|
169
|
+
if(typeof date === 'string'){
|
|
170
|
+
yearMonth = date;
|
|
171
|
+
}else if (typeof date === 'object'){
|
|
172
|
+
yearMonth = date.getFullYear()+'-'+(date.getMonth()+1);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return this.context.ready.then((axios) => {
|
|
176
|
+
return axios.post(`/api/v2/coremde-sale/checkin/list`, {
|
|
177
|
+
userId,
|
|
178
|
+
yearMonth
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
133
184
|
}
|