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

@@ -31,7 +31,6 @@ const API_PATHS = {
},
// 获取短信验证码
SMS_CODE: {
v1: '/resource/sms/code',
v2: '/resource/sms/code',
},
// 微信手机号登录
@@ -50,23 +49,19 @@ const API_PATHS = {
HOME: {
// 塘口列表模式1
POND_LIST: {
v1: '/fishery/pond/list',
v2: '/fishery/pond/list_mode1',
},
// 塘口列表模式2
POND_LIST_MODE2: {
v1: '/api/pond/list_mode2',
v2: '/fishery/pond/list/mode2',
v2: '/fishery/pond/list_mode2',
},
// 公告列表
NOTICE_LIST: {
v1: '/api/sys-notice/notice_list',
v2: '/fishery/notice/list',
v2: '/system/notice/list',
},
// 即将到期设备列表
DEVICE_DEAD: {
v1: '/api/device/list_device_dead',
v2: '/fishery/device/expiring',
v2: '/fishery/device/list_device_dead',
},
// 获取设备票据
DEVICE_TICKET: {
@@ -99,12 +94,10 @@ const API_PATHS = {
},
// 塘口下设备信息
DEVICE_INFO: {
v1: '/api/pond/pond_device_info',
v2: '/fishery/pond/devices',
},
// 将设备及开关绑定到塘口
BIND_DEVICE: {
v1: '/api/pond/select_device_switch',
v2: '/fishery/pond/bind/device',
},
// 夜间防误触
@@ -118,42 +111,34 @@ const API_PATHS = {
DEVICE: {
// 设备列表
LIST_ALL: {
v1: '/api/device/list_all_device',
v2: '/fishery/device/list_all_device',
},
// 设备详情
INFO: {
v1: '/api/device/one_device_info',
v2: '/fishery/device/info',
v2: '/fishery/device/one_device_info',
},
// 解除绑定
UNBIND: {
v1: '/api/device/break_pond',
v2: '/fishery/device/unbind',
v2: '/fishery/device/break_pond',
},
// 设备图表数据
HISTORY: {
v1: '/api/device/data_history',
v2: '/fishery/device/history',
v2: '/td/device/getHistoryData',
},
// 修改设备名称
UPDATE_NAME: {
v1: '/api/device/update_name',
v2: '/fishery/device/name',
v2: '/fishery/device/update_name',
},
// 修改设备关联塘口
UPDATE_POND: {
v1: '/api/device/update_pond',
v2: '/fishery/device/pond',
v2: '/fishery/pond/update_pond',
},
// 修改设备接电方式
UPDATE_VOLTAGE: {
v1: '/api/device/update_voltage_type',
v2: '/fishery/device/voltage',
v2: '/iot/device/voltage_type',
},
// 删除设备
DELETE: {
v1: '/api/device/delete',
v2: '/fishery/device',
},
// 扫描设备编码
@@ -167,13 +152,11 @@ const API_PATHS = {
},
// 盐度设置
SET_SALINITY: {
v1: '/api/device/detector_salinitycompensation',
v2: '/fishery/device/salinity',
v2: '/iot/device/salinity-compensation',
},
// 设备校准
CALIBRATE: {
v1: '/api/device/detector_calibrate',
v2: '/fishery/device/calibrate',
v2: '/iot/device/calibrate',
},
// 添加水质检测仪
ADD_DETECTOR: {
@@ -181,38 +164,31 @@ const API_PATHS = {
},
// 设置溶解氧/水温告警
SET_WARN_CALL: {
v1: '/api/device/set_oxy_warn_call',
v2: '/fishery/device/warn/call',
v2: '/fishery/device/set_oxy_warn_call',
},
// 设置溶解氧上下限
SET_OXY_WARN: {
v1: '/api/device/set_oxy_warn_value',
v2: '/fishery/device/warn/oxy',
v2: '/fishery/device/set_oxy_warn_value',
},
// 设置温度上下限
SET_TEMP_WARN: {
v1: '/api/device/set_temp_warn_value',
v2: '/fishery/device/warn/temp',
v2: '/fishery/device/set_temp_warn_value',
},
// 溶解氧饱和度
GET_SATURABILITY: {
v1: '/api/device/get_saturability',
v2: '/fishery/device/saturability',
v2: '/fishery/device/get_saturability',
},
// 添加控制一体机
ADD_CONTROLLER: {
v1: '/api/device/add_device_controller',
v2: '/iot/device/add_device_controller',
},
// 启停溶解氧
SET_OXY_OPEN: {
v1: '/api/device/set_controller_oxy_open',
v2: '/fishery/device/oxy/switch',
v2: '/fishery/device/set_controller_oxy_open',
},
// 电压告警开关
VOLTAGE_CHECK: {
v1: '/api/device/voltage_check_open',
v2: '/fishery/device/voltage/check',
v2: '/fishery/device/voltage_check_open',
},
},
@@ -220,28 +196,23 @@ const API_PATHS = {
LINKED_CTRL: {
// 设备控制器列表
LIST: {
v1: '/api/linked-ctrl/fetch',
v2: '/fishery/linked-ctrl/list',
v2: '/fishery/linkedCtrl/fetch',
},
// 添加联动控制
ADD: {
v1: '/api/linked-ctrl/add',
v2: '/fishery/linked-ctrl',
v2: '/fishery/linkedCtrl/add',
},
// 修改联动控制
UPDATE: {
v1: '/api/linked-ctrl/update',
v2: '/fishery/linked-ctrl',
v2: '/fishery/linkedCtrl/update',
},
// 删除联动控制
DELETE: {
v1: '/api/linked-ctrl/delete',
v2: '/fishery/linked-ctrl',
v2: '/fishery/linkedCtrl',
},
// 设置联动控制上下限开关
SET_OPEN: {
v1: '/api/linked-ctrl/set_open',
v2: '/fishery/linked-ctrl/switch',
v2: '/fishery/linkedCtrl/set_open',
},
},
@@ -249,48 +220,39 @@ const API_PATHS = {
SWITCH: {
// 开关列表
POND_LIST: {
v1: '/api/device-switch/get_pond_switch',
v2: '/fishery/switch/list',
v2: '/fishery/deviceSwitch/get_pond_switch',
},
// 开关详情
INFO: {
v1: '/api/device-switch/one_switch_info',
v2: '/fishery/switch/info',
v2: '/fishery/deviceSwitch/one_switch_info',
},
// 修改开关名称
UPDATE_NAME: {
v1: '/api/device-switch/update_name',
v2: '/fishery/switch/name',
v2: '/fishery/deviceSwitch/update_name',
},
// 修改关联塘口
UPDATE_POND: {
v1: '/api/device-switch/update_pond',
v2: '/fishery/switch/pond',
v2: '/iot/switch/update_pond',
},
// 修改接线方式
UPDATE_VOLTAGE: {
v1: '/api/device-switch/update_voltage_type',
v2: '/fishery/switch/voltage',
v2: '/iot/switch/update_voltage_type',
},
// 单个开关启停
TURN: {
v1: '/api/device-switch/turn_switch',
v2: '/fishery/switch/turn',
v2: '/iot/switch/turn_switch',
},
// 所有开关启停
TURN_POND: {
v1: '/api/device-switch/turn_pond_switch',
v2: '/fishery/switch/turn/all',
v2: '/iot/switch/turn_pond_switch',
},
// 电流告警开关
ELECTRIC_CHECK: {
v1: '/api/device-switch/electric_check_open',
v2: '/fishery/switch/electric/check',
v2: '/fishery/deviceSwitch/electric_check_open',
},
// 电流告警设置
ELECTRIC_SET: {
v1: '/api/device-switch/electric_set',
v2: '/fishery/switch/electric/set',
v2: '/iot/switch/electric_set',
},
},

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){

View File

@@ -14,7 +14,12 @@ export function getPond1() {
// 塘口模式2
export function getPond2(){
return httpService.get(API.HOME.POND_LIST_MODE2())
const userId = Taro.getStorageSync("UserId");
return httpService.get(API.HOME.POND_LIST_MODE2(), {
params: {
rootUserId: userId || undefined
}
});
}
// 公告列表
@@ -24,7 +29,12 @@ export function noticeList(){
// 即将到期设备列表
export function deviceDead(){
return httpService.get(API.HOME.DEVICE_DEAD())
const userId = Taro.getStorageSync("UserId");
return httpService.get(API.HOME.DEVICE_DEAD(), {
params: {
rootUserId: userId || undefined
}
});
}
// 获取设备票据