企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 代码 ``` <?php namespace app\agent\controller; use think\Controller; class RbacController extends Controller { /** * 添加角色提交 */ public function roleAddPost() { if ($this->request->isPost()) { $data = $this->request->param(); $result = $this->validate($data, 'role'); if ($result !== true) { // 验证失败 输出错误信息 $this->error($result); } else { $result = Db::name('role')->insert($data); if ($result) { $this->success("添加角色成功", url("rbac/index")); } else { $this->error("添加角色失败"); } } } } } ```