fix: 主子账号相关问题修复。

This commit is contained in:
tianyongbao
2026-01-20 16:11:45 +08:00
parent b106703f91
commit ccb493a6a8
6 changed files with 42 additions and 13 deletions

View File

@@ -68,7 +68,9 @@ export function deviceCalibration(data){
/** 水质检测仪------------------------------------------------ */
// 添加-水质检测仪
export function addDeviceDetector(data) {
return httpService.post(API.DEVICE.ADD_DETECTOR(), {data})
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
return httpService.post(`${API.DEVICE.ADD_DETECTOR()}?rootUserId=${userId}`, {data})
}
// 设置溶解氧/水温告警
export function setWarnCall(data){
@@ -95,7 +97,9 @@ export function getSaturability(data){
/** 控制一体机------------------------------------------------ */
// 添加-控制一体机
export function addDeviceController(data) {
return httpService.post(API.DEVICE.ADD_CONTROLLER(), {data})
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
return httpService.post(`${API.DEVICE.ADD_CONTROLLER()}?rootUserId=${userId}`, {data})
}
// 启停溶解氧
export function setOxyOpen(data){

View File

@@ -1,20 +1,28 @@
import httpService from '@/utils/request'
import API from './config'
import Taro from '@tarojs/taro'
import { useRootUserStore } from '@/store/index'
// 查询充值记录
export function msgPay(data) {
return httpService.get(API.MESSAGE.PAY(), { params: data })
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
return httpService.get(API.MESSAGE.PAY(), { params: { ...data, rootUserId: userId } })
}
// 查询报警记录
export function msgWarn(data) {
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
// 后端接口GET /fishery/messageWarn/list使用查询参数传递分页信息
return httpService.get(API.MESSAGE.WARN(), { params: data })
return httpService.get(API.MESSAGE.WARN(), { params: { ...data, rootUserId: userId } })
}
// 查询开关记录
export function msgSwitch(data) {
return httpService.get(API.MESSAGE.SWITCH(), { params: data })
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
return httpService.get(API.MESSAGE.SWITCH(), { params: { ...data, rootUserId: userId } })
}
// 已读一条消息

View File

@@ -1,5 +1,8 @@
import httpService from '@/utils/request'
import API from './config'
import Taro from '@tarojs/taro'
import { useRootUserStore } from '@/store/index'
// 新增塘口
export function PondAdd(data) {
return httpService.post(API.POND.ADD(), {data})
@@ -19,10 +22,14 @@ export function fishList(){
}
// 塘口基本数据
export function pondBaseInfo(data){
return httpService.get(API.POND.BASE_INFO() + '/' + data.id)
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
return httpService.get(`${API.POND.BASE_INFO()}/${data.id}?rootUserId=${userId}`)
}
// 塘口下设备信息
export function pondDeviceInfo(data){
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
// 后端接口GET /devices/{pondId},使用路径参数
return httpService.get(API.POND.DEVICE_INFO() + '/' + data.id)
return httpService.get(`${API.POND.DEVICE_INFO()}/${data.id}?rootUserId=${userId}`)
}

View File

@@ -175,9 +175,16 @@ function setOpen({ value, event }, item: any) {
state.show = true;
state.msg = "设置成功";
}else{
state.show = true;
state.msg = res.msg || "设置失败";
getTimingList();
}
})
}).catch((error) => {
console.error('[定时开关设置] 失败:', error);
state.show = true;
state.msg = "网络错误,设置失败";
getTimingList();
});
}
}
/** method end--------------------- */

View File

@@ -303,7 +303,8 @@ function changeVal(e) {
}
// 查询告警消息
function getWarnMsg() {
const userId = Taro.getStorageSync("UserId");
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
const params = {
...warnParams.value,
userId
@@ -334,7 +335,8 @@ function getWarnMsg() {
}
// 查询开关消息
function getSwitchMsg() {
const userId = Taro.getStorageSync("UserId");
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
const params = {
...switchParams.value,
userId
@@ -350,7 +352,8 @@ function getSwitchMsg() {
}
// 查询充值消息
function getPayMsg() {
const userId = Taro.getStorageSync("UserId");
const store = useRootUserStore();
const userId = store.getRootUserId || Taro.getStorageSync('UserId');
const params = {
...payParams.value,
userId

View File

@@ -12,8 +12,8 @@ const getBaseUrl = () => {
BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
} else {
// BASE_URL = 'https://api.yuceyun.cn' //填写你的请求域名
BASE_URL = 'https://api.yuceyun.cn/fishery-api' // 测试环境
// BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
// BASE_URL = 'https://api.yuceyun.cn/fishery-api' // 测试环境
BASE_URL = 'http://127.0.0.1:8080' // 本地调试后端地址
// BASE_URL = 'http://47.102.210.182:6678' //测试环境
}
return BASE_URL