index.js
870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//获取设备分页API 修改为post
/**
* params ((page,pageSize))
* data ((deviceProfileIds))
*/
const getDeviceApi = (urlParams, data) => {
const {
page,
pageSize,
} = urlParams
return uni.$u.http.post(`/yt/device?page=${page}&pageSize=${pageSize}`, data);
};
// 设备详情
const getDeviceDetail = (id) => {
return uni.$u.http.get(`/yt/device/${id}`);
};
//设备属性
const getAttribute = (deviceProfileId) => {
return uni.$u.http.get(`/yt/device/attributes/${deviceProfileId}`);
};
//命令下发
const issueCommand = (type, tbDeviceId, data) => {
return uni.$u.http.post(`/rpc/${type==='OneWay'?'oneway':'twoway'}/${tbDeviceId}`, data)
}
//获取命令下发记录
const getRpcRecord = (params) => {
return uni.$u.http.get('/yt/rpc', params);
};
export default {
getDeviceApi,
getDeviceDetail,
getAttribute,
issueCommand,
getRpcRecord
}