index.js 870 Bytes
//获取设备分页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
}