From 7a4f40de546fd25e6e1c5d17411cb3a469602e1a Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Tue, 23 Dec 2025 11:38:25 +0800 Subject: [PATCH] 1111 --- .../controller/ContentLibraryController.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Server/application/cunkebao/controller/ContentLibraryController.php b/Server/application/cunkebao/controller/ContentLibraryController.php index 418fb6c9..1151a876 100644 --- a/Server/application/cunkebao/controller/ContentLibraryController.php +++ b/Server/application/cunkebao/controller/ContentLibraryController.php @@ -787,16 +787,24 @@ class ContentLibraryController extends Controller return json(['code' => 400, 'msg' => '参数错误']); } + + $where = [ + ['i.id', '=', $id], + ['l.companyId', '=', $this->request->userInfo['companyId']] + ]; + + if(empty($this->request->userInfo['isAdmin'])){ + $where[] = ['l.userId', '=', $this->request->userInfo['id']]; + } + // 查询内容项目是否存在并检查权限 $item = ContentItem::alias('i') ->join('content_library l', 'i.libraryId = l.id') - ->where([ - ['i.id', '=', $id], - ['l.companyId', '=', $this->request->userInfo['companyId']] - ]) + ->where($where) ->find(); - if (!$item) { + + if(empty($item)) { return json(['code' => 500, 'msg' => '内容项目不存在或无权限操作']); }