私域操盘手 - 修复设备配置错误的问题

This commit is contained in:
柳清爽
2025-05-08 15:16:29 +08:00
parent 40000b397b
commit 6354dd8565
5 changed files with 11 additions and 11 deletions

View File

@@ -370,7 +370,7 @@ export default function DeviceDetailPage() {
}
// 直接使用fetch而不是通过API工具
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/v1/task-config`, {
const response = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/v1/devices/task-config`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',

View File

@@ -136,7 +136,7 @@ export const deviceApi = {
momentsSync?: number;
aiChat?: number;
}): Promise<ApiResponse<Device>> {
const response = await fetch(`${API_BASE}/task-config`, {
const response = await fetch(`${API_BASE}/devices/task-config`, {
method: "POST",
headers: {
"Content-Type": "application/json",

View File

@@ -73,7 +73,7 @@ class GetDeviceDetailV1Controller extends BaseController
$conf = DeviceTaskconfModel::alias('c')
->field([
'c.autoAddFriend', 'c.autoReply', 'c.contentSync', 'c.aiChat'
'c.autoAddFriend', 'c.autoReply', 'c.momentsSync', 'c.aiChat'
])
->where($where)
->find();
@@ -83,7 +83,7 @@ class GetDeviceDetailV1Controller extends BaseController
}
// 未配置时赋予默认关闭的状态
return ArrHelper::getValue('autoAddFriend,autoReply,contentSync,aiChat', [], 0);
return ArrHelper::getValue('autoAddFriend,autoReply,momentsSync,aiChat', [], 0);
}
/**

View File

@@ -32,7 +32,7 @@ class GetRelatedAccountsV1Controller extends BaseController
$hasPermission = DeviceUserModel::where($where)->count() > 0;
if (!$hasPermission) {
throw new \Exception('您没有权限查看该设备', '403');
throw new \Exception('您没有权限查看该设备', 403);
}
}

View File

@@ -33,7 +33,7 @@ class UpdateDeviceTaskConfigV1Controller extends BaseController
$device = DeviceModel::find($where);
if (!$device) {
throw new \Exception('设备不存在或已删除', '404');
throw new \Exception('设备不存在或已删除', 404);
}
}
@@ -54,7 +54,7 @@ class UpdateDeviceTaskConfigV1Controller extends BaseController
$hasPermission = DeviceUserModel::where($where)->count() > 0;
if (!$hasPermission) {
throw new \Exception('您没有权限操作该设备', '403');
throw new \Exception('您没有权限操作该设备', 403);
}
}
@@ -71,12 +71,12 @@ class UpdateDeviceTaskConfigV1Controller extends BaseController
$content = null;
if (isset($data['autoAddFriend']))/**/ $content = $data['autoAddFriend'] ? '开启自动添加好友' : '关闭自动添加好友';
if (isset($data['autoReply']))/* */ $content = $data['autoReply'] ? '开启自动回复' : '关闭自动回复';
if (isset($data['momentsSync']))/* */ $content = $data['momentsSync'] ? '开启朋友圈同步' : '关闭朋友圈同步';
if (isset($data['aiChat']))/* */ $content = $data['aiChat'] ? '开启AI会话' : '关闭AI会话';
if (isset($data['autoReply']))/* */ $content = $data['autoReply'] ? '开启自动回复' : '关闭自动回复';
if (isset($data['momentsSync']))/* */ $content = $data['momentsSync'] ? '开启朋友圈同步' : '关闭朋友圈同步';
if (isset($data['aiChat']))/* */ $content = $data['aiChat'] ? '开启AI会话' : '关闭AI会话';
if (empty($content)) {
throw new \Exception('参数错误', '400');
throw new \Exception('参数错误', 400);
}
DeviceHandleLogModel::addLog(