feat: use community categories for topic navigation

This commit is contained in:
hajimi
2026-08-02 18:44:35 +08:00
parent 75b003619b
commit 3c2dddd6d1
3 changed files with 73 additions and 35 deletions
@@ -7,6 +7,7 @@ use app\common\model\community\CommunityPost;
use app\common\model\community\CommunityComment;
use app\common\model\community\CommunityLike;
use app\common\model\community\CommunityFollow;
use app\common\model\community\CommunityCategory;
use app\common\model\community\CommunityTag;
use app\common\model\user\User;
use app\common\model\ai\AiAnalysis;
@@ -24,7 +25,7 @@ class CommunityController extends BaseApiController
{
private const LIUHE_TAGS = ['旧澳六合', '新澳六合'];
public array $notNeedLogin = ['postLists', 'postDetail', 'commentLists', 'tagLists', 'userProfile', 'followList', 'fansList'];
public array $notNeedLogin = ['postLists', 'postDetail', 'commentLists', 'tagLists', 'categoryLists', 'userProfile', 'followList', 'fansList'];
// 帖子列表
public function postLists()
@@ -423,6 +424,18 @@ class CommunityController extends BaseApiController
return $this->data($list);
}
// 分类列表
public function categoryLists()
{
$list = CommunityCategory::where('status', 1)
->order('sort desc')
->order('id desc')
->field('id,name,icon,post_count')
->select()
->toArray();
return $this->data($list);
}
// 购买帖子
// confirm=0 探测是否已购买;confirm=1 确认扣分购买
public function purchasePost()