From 6354dd8565056712ecc5b486a68a7c8d00c8bf8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=B8=85=E7=88=BD?= Date: Thu, 8 May 2025 15:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=81=E5=9F=9F=E6=93=8D=E7=9B=98=E6=89=8B?= =?UTF-8?q?=20-=20=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cunkebao/app/devices/[id]/page.tsx | 2 +- Cunkebao/lib/api/devices.ts | 2 +- .../device/GetDeviceDetailV1Controller.php | 4 ++-- .../device/GetRelatedAccountsV1Controller.php | 2 +- .../device/UpdateDeviceTaskConfigV1Controller.php | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cunkebao/app/devices/[id]/page.tsx b/Cunkebao/app/devices/[id]/page.tsx index 5d050a47..79e16959 100644 --- a/Cunkebao/app/devices/[id]/page.tsx +++ b/Cunkebao/app/devices/[id]/page.tsx @@ -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', diff --git a/Cunkebao/lib/api/devices.ts b/Cunkebao/lib/api/devices.ts index 9facd1fc..c01be6f9 100644 --- a/Cunkebao/lib/api/devices.ts +++ b/Cunkebao/lib/api/devices.ts @@ -136,7 +136,7 @@ export const deviceApi = { momentsSync?: number; aiChat?: number; }): Promise> { - const response = await fetch(`${API_BASE}/task-config`, { + const response = await fetch(`${API_BASE}/devices/task-config`, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/Server/application/cunkebao/controller/device/GetDeviceDetailV1Controller.php b/Server/application/cunkebao/controller/device/GetDeviceDetailV1Controller.php index e09bdbae..6e5a454b 100644 --- a/Server/application/cunkebao/controller/device/GetDeviceDetailV1Controller.php +++ b/Server/application/cunkebao/controller/device/GetDeviceDetailV1Controller.php @@ -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); } /** diff --git a/Server/application/cunkebao/controller/device/GetRelatedAccountsV1Controller.php b/Server/application/cunkebao/controller/device/GetRelatedAccountsV1Controller.php index 346546f1..f46e91e4 100644 --- a/Server/application/cunkebao/controller/device/GetRelatedAccountsV1Controller.php +++ b/Server/application/cunkebao/controller/device/GetRelatedAccountsV1Controller.php @@ -32,7 +32,7 @@ class GetRelatedAccountsV1Controller extends BaseController $hasPermission = DeviceUserModel::where($where)->count() > 0; if (!$hasPermission) { - throw new \Exception('您没有权限查看该设备', '403'); + throw new \Exception('您没有权限查看该设备', 403); } } diff --git a/Server/application/cunkebao/controller/device/UpdateDeviceTaskConfigV1Controller.php b/Server/application/cunkebao/controller/device/UpdateDeviceTaskConfigV1Controller.php index fb747ea4..97c326a9 100644 --- a/Server/application/cunkebao/controller/device/UpdateDeviceTaskConfigV1Controller.php +++ b/Server/application/cunkebao/controller/device/UpdateDeviceTaskConfigV1Controller.php @@ -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(