ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` <?php namespace app\agent\controller; use app\agent\model\AgentCategoryModel; use think\Controller; class AdminCategoryController extends Controller { /** * 编辑文章分类 */ public function edit() { $id = $this->request->param('id', 0, 'intval'); if ($id > 0) { $category = AgentCategoryModel::get($id)->toArray(); $agentCategoryModel = new AgentCategoryModel(); $categoriesTree = $agentCategoryModel->adminCategoryTree($category['parent_id'], $id); $this->assign($category); $this->assign('categories_tree', $categoriesTree); return $this->fetch(); } else { $this->error('操作错误!'); } } } ```