群推送
This commit is contained in:
@@ -111,10 +111,16 @@ class ContentLibraryController extends Controller
|
||||
$sourceType = $this->request->param('sourceType', ''); // 新增:来源类型,1=好友,2=群
|
||||
|
||||
$where = [
|
||||
['userId', '=', $this->request->userInfo['id']],
|
||||
['companyId' , '=', $this->request->userInfo['companyId']],
|
||||
['isDel', '=', 0] // 只查询未删除的记录
|
||||
];
|
||||
|
||||
if(empty($this->request->userInfo['isAdmin'])){
|
||||
$where[] = ['userId', '=', $this->request->userInfo['id']];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 添加名称模糊搜索
|
||||
if ($keyword !== '') {
|
||||
$where[] = ['name', 'like', '%' . $keyword . '%'];
|
||||
@@ -307,11 +313,18 @@ class ContentLibraryController extends Controller
|
||||
return json(['code' => 400, 'msg' => '内容库名称不能为空']);
|
||||
}
|
||||
|
||||
|
||||
$where = [
|
||||
['companyId' , '=', $this->request->userInfo['companyId']],
|
||||
['isDel', '=', 0] // 只查询未删除的记录
|
||||
];
|
||||
|
||||
if(empty($this->request->userInfo['isAdmin'])){
|
||||
$where[] = ['userId', '=', $this->request->userInfo['id']];
|
||||
}
|
||||
|
||||
// 查询内容库是否存在
|
||||
$library = ContentLibrary::where([
|
||||
['id', '=', $param['id']],
|
||||
['userId', '=', $this->request->userInfo['id']]
|
||||
])->find();
|
||||
$library = ContentLibrary::where($where)->find();
|
||||
|
||||
if (!$library) {
|
||||
return json(['code' => 500, 'msg' => '内容库不存在']);
|
||||
@@ -766,16 +779,20 @@ class ContentLibraryController extends Controller
|
||||
$content = Request::param('content', '');
|
||||
$companyId = $this->request->userInfo['companyId'];
|
||||
// 简单验证
|
||||
if (empty($id)) {
|
||||
if (empty($id) && empty($content)) {
|
||||
return json(['code' => 400, 'msg' => '参数错误']);
|
||||
}
|
||||
|
||||
// 查询内容项目是否存在并检查权限
|
||||
$item = ContentItem::alias('ci')
|
||||
->join('content_library cl', 'ci.libraryId = cl.id')
|
||||
->where(['ci.id' => $id, 'ci.isDel' => 0, 'cl.isDel' => 0, 'cl.companyId' => $companyId])
|
||||
->field('ci.*')
|
||||
->find();
|
||||
if(!empty($id)) {
|
||||
// 查询内容项目是否存在并检查权限
|
||||
$item = ContentItem::alias('ci')
|
||||
->join('content_library cl', 'ci.libraryId = cl.id')
|
||||
->where(['ci.id' => $id, 'ci.isDel' => 0, 'cl.isDel' => 0, 'cl.companyId' => $companyId])
|
||||
->field('ci.*')
|
||||
->find();
|
||||
}else{
|
||||
$item['content'] = $content;
|
||||
}
|
||||
|
||||
if (empty($item)) {
|
||||
return json(['code' => 500, 'msg' => '内容项目不存在或无权限操作']);
|
||||
|
||||
Reference in New Issue
Block a user