1111
This commit is contained in:
@@ -787,16 +787,24 @@ class ContentLibraryController extends Controller
|
|||||||
return json(['code' => 400, 'msg' => '参数错误']);
|
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')
|
$item = ContentItem::alias('i')
|
||||||
->join('content_library l', 'i.libraryId = l.id')
|
->join('content_library l', 'i.libraryId = l.id')
|
||||||
->where([
|
->where($where)
|
||||||
['i.id', '=', $id],
|
|
||||||
['l.companyId', '=', $this->request->userInfo['companyId']]
|
|
||||||
])
|
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
if (!$item) {
|
|
||||||
|
if(empty($item)) {
|
||||||
return json(['code' => 500, 'msg' => '内容项目不存在或无权限操作']);
|
return json(['code' => 500, 'msg' => '内容项目不存在或无权限操作']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user