feature:

1.OTA基本能力(固定配置),待优化
2.智能体管理与设备管理对接api,实现流程闭环(已测试)
This commit is contained in:
Erlei Chen
2025-03-24 09:26:45 +08:00
parent 66352de1eb
commit bdd18b384b
55 changed files with 1747 additions and 332 deletions
+2 -5
View File
@@ -16,20 +16,17 @@ export default {
}).send()
},
//添加智能体
addAgent(name, callback) {
addAgent(agentName, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/user/agent`)
.method('POST')
.data({name})
.data({agentName})
.success((res) => {
RequestService.clearRequestTime();
callback(res);
})
.fail((err) => {
console.error('添加智能体失败:', err);
RequestService.reAjaxFun(() => {
this.addAgent(name, callback);
});
}).send();
},
//获取智能体配置
+9 -8
View File
@@ -4,9 +4,10 @@ import {getServiceUrl} from '../api'
export default {
//设备列表
getDeviceList(agent_id, callback) {
getDeviceList(agent_id, page, callback) {
RequestService.sendRequest().url(`${getServiceUrl()}/api/v1/user/agent/device/bind/${agent_id}`)
.method('GET')
.data(page)
.success((res) => {
RequestService.clearRequestTime()
callback(res)
@@ -16,11 +17,11 @@ export default {
}).send()
},
//绑定设备
bindDevice(agent_id, code, callback) {
bindDevice(agentId, deviceCode, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/user/agent/device/bind/${agent_id}`)
.url(`${getServiceUrl()}/api/v1/user/agent/device/bind/${agentId}`)
.method('POST')
.data({code})
.data({deviceCode})
.success((res) => {
RequestService.clearRequestTime();
callback(res);
@@ -28,14 +29,14 @@ export default {
.fail((err) => {
console.error('绑定设备失败:', err);
RequestService.reAjaxFun(() => {
this.addDevice(name, callback);
this.addDevice(agentId, deviceCode, callback);
});
}).send();
},
// 解绑设备
unbindDevice(device_id, callback) {
unbindDevice(deviceId, callback) {
RequestService.sendRequest()
.url(`${getServiceUrl()}/api/v1/user/device/unbind/${device_id}`)
.url(`${getServiceUrl()}/api/v1/user/agent/device/unbind/${deviceId}`)
.method('PUT')
.success((res) => {
RequestService.clearRequestTime();
@@ -43,7 +44,7 @@ export default {
})
.fail(() => {
RequestService.reAjaxFun(() => {
this.unbindDevice(device_id, callback);
this.unbindDevice(deviceId, callback);
});
}).send()
},