私域操盘手 - 修复设备详情页面因为 ArrHelper::getvalue() 传参不严谨到的500错误

This commit is contained in:
柳清爽
2025-05-08 14:58:41 +08:00
parent 73dd0f51dc
commit 9465f19479

View File

@@ -34,7 +34,7 @@ class GetDeviceDetailV1Controller extends BaseController
$hasPermission = DeviceUserModel::where($where)->count() > 0;
if (!$hasPermission) {
throw new \Exception('您没有权限查看该设备', '403');
throw new \Exception('您没有权限查看该设备', 403);
}
}
@@ -78,9 +78,12 @@ class GetDeviceDetailV1Controller extends BaseController
->where($where)
->find();
return $conf
? $conf->toArray()
: ArrHelper::getValue([], 'autoAddFriend,autoReply,contentSync,aiChat', 0);
if (!is_null($conf)) {
return $conf->toArray();
}
// 未配置时赋予默认关闭的状态
return ArrHelper::getValue('autoAddFriend,autoReply,contentSync,aiChat', [], 0);
}
/**
@@ -131,7 +134,7 @@ class GetDeviceDetailV1Controller extends BaseController
->find($id);
if (empty($device)) {
throw new \Exception('设备不存在', '404');
throw new \Exception('设备不存在', 404);
}
$device['battery'] = $this->parseExtraForBattery($device['extra']);