更新blog界面

This commit is contained in:
2026-03-20 20:35:00 +08:00
parent b3a25ceb82
commit d30a2531a7
7 changed files with 87 additions and 94 deletions
@@ -5,14 +5,14 @@ declare(strict_types=1);
namespace app\index\controller\Article;
use app\index\BaseController;
use app\model\Articles;
use app\model\ArticlesCategory;
use Symfony\Component\VarDumper\VarDumper;
use think\exception\ValidateException;
use think\facade\Request;
use think\facade\Session;
use think\response\Json;
use think\db\exception\DbException;
use app\model\Cms\Articles;
use app\model\Cms\ArticlesCategory;
class ArticleController extends BaseController
{
@@ -102,6 +102,34 @@ class ArticleController extends BaseController
}
}
/**
* 获取文章分类列表
* @return Json
*/
public function getArticleCategories(): Json
{
$tid = $this->getTenantId();
if (empty($tid)) {
return json([
'code' => 400,
'msg' => '无法识别租户信息',
'list' => [],
]);
}
$articleCategories = ArticlesCategory::where('delete_time', null)
->where('tid', $tid)
->select()
->toArray();
return json([
'code' => 200,
'msg' => 'success',
'list' => $articleCategories,
]);
}
/**
* 游客文章阅读量函数
* @return Json