群推送

This commit is contained in:
wong
2025-11-13 16:10:47 +08:00
parent 268da6e47c
commit 93b4834539
5 changed files with 1806 additions and 243 deletions

View File

@@ -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' => '内容项目不存在或无权限操作']);