fix: 后台接口对接,问题修复及线上提交测试。

This commit is contained in:
tianyongbao
2026-01-14 08:29:38 +08:00
parent 6d1a6ded2d
commit f5ddf1e120
16 changed files with 1316 additions and 810 deletions

View File

@@ -1,5 +1,6 @@
import httpService from '@/utils/request'
import API from './config'
import Taro from '@tarojs/taro'
/** 设备相关接口---------------------------------------- */
// 设备列表
@@ -8,27 +9,31 @@ export function allDeviceList(params) {
}
// 设备详情
export function deviceInfo(data){
return httpService.post(API.DEVICE.INFO(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.post(`${API.DEVICE.INFO()}?rootUserId=${userId}`, {data})
}
// 解除绑定
export function deviceUnbind(data){
return httpService.post(API.DEVICE.UNBIND(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.post(`${API.DEVICE.UNBIND()}?rootUserId=${userId}`, {data})
}
// 将设备及开关绑定到塘口
export function bandDeviceToPond(data){
return httpService.put(API.POND.BIND_DEVICE(), {data})
}
// 设备图表数据
export function deviceHistory(data){
return httpService.post(API.DEVICE.HISTORY(), {data})
export function deviceHistory(params){
return httpService.get(API.DEVICE.HISTORY(), {params})
}
// 修改设备名称
export function deviceUpdateName(data){
return httpService.put(API.DEVICE.UPDATE_NAME(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.put(`${API.DEVICE.UPDATE_NAME()}?rootUserId=${userId}`, {data})
}
// 修改设备关联塘口
export function deviceUpdatePond(data){
return httpService.put(API.DEVICE.UPDATE_POND(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.put(`${API.DEVICE.UPDATE_POND()}?rootUserId=${userId}`, {data})
}
// 修改设备接电方式
export function deviceUpdateV(data){
@@ -36,7 +41,8 @@ export function deviceUpdateV(data){
}
// 删除设备
export function deviceDel(data){
return httpService.delete(API.DEVICE.DELETE(), {data})
// 后端需要 /{ids} 路径参数,传入 ID 数组
return httpService.delete(`${API.DEVICE.DELETE()}/${data.id}`)
}
// 扫描设备编码
export function deviceScan(params){
@@ -61,15 +67,18 @@ export function addDeviceDetector(data) {
}
// 设置溶解氧/水温告警
export function setWarnCall(data){
return httpService.post(API.DEVICE.SET_WARN_CALL(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.post(`${API.DEVICE.SET_WARN_CALL()}?rootUserId=${userId}`, {data})
}
// 设置溶解氧上下限
export function setOxyWarn(data){
return httpService.put(API.DEVICE.SET_OXY_WARN(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.put(`${API.DEVICE.SET_OXY_WARN()}?rootUserId=${userId}`, {data})
}
// 设置温度上下限
export function setTempWarn(data){
return httpService.put(API.DEVICE.SET_TEMP_WARN(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.put(`${API.DEVICE.SET_TEMP_WARN()}?rootUserId=${userId}`, {data})
}
// 溶解氧饱和度
export function getSaturability(data){
@@ -82,7 +91,8 @@ export function addDeviceController(data) {
}
// 启停溶解氧
export function setOxyOpen(data){
return httpService.put(API.DEVICE.SET_OXY_OPEN(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.put(`${API.DEVICE.SET_OXY_OPEN()}?rootUserId=${userId}`, {data})
}
/** 联动控制------------------------------------- */
// 设备控制器列表
@@ -99,7 +109,9 @@ export function updateLinkerCtrl(data){
}
// 删除联动控制
export function delLinkerCtrl(data){
return httpService.delete(API.LINKED_CTRL.DELETE(), {data})
const userId = Taro.getStorageSync('UserId');
// 后端需要 /{ids} 路径参数
return httpService.delete(`${API.LINKED_CTRL.DELETE()}/${data.id}?rootUserId=${userId}`)
}
// 设置联动控制上下限开关
export function setLinkOpen(data){
@@ -137,7 +149,8 @@ export function turnPondSwitch(data){
// 电压告警开关 开启或关闭
export function voltageCheckOpen(data){
return httpService.put(API.DEVICE.VOLTAGE_CHECK(), {data})
const userId = Taro.getStorageSync('UserId');
return httpService.put(`${API.DEVICE.VOLTAGE_CHECK()}?rootUserId=${userId}`, {data})
}
// 电流告警开关 开启或关闭
export function electricCheckOpen(data){