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(