1、帖子搜索

2、收藏搜索
3、帖子、评论删除
This commit is contained in:
2025-12-10 10:29:41 +08:00
parent ad0527600a
commit 4d94614d40
9 changed files with 98 additions and 7 deletions
@@ -46,6 +46,25 @@ class PostFavoriteService
return $this->postProcess(ucfirst($scene), $result);
}
public function complexQueryIndex(Request $request)
{
$param = $request->all();
$limit = (int)$request->get('size', 15);
$page = (int)$request->get('current', 1);
$query = PostFavorite::with(['post'])
->where('user_id',$request->user->uid)
->whereHas('post', function ($q) use ($param) {
// 固定过滤 status = 1
$q->where('status', 1);
// 关键字过滤(如果存在)
if (!empty($param['keyword'])) {
$q->where('content', 'like', "%{$param['keyword']}%");
}
});
return $query->paginate($limit, ['*'], 'page', $page);
}
/**
* 构造 CrudUtil 查询配置
*/