💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 控制器 ## 代码 ``` <?php namespace app\agent\controller; use think\Controller; use think\Db; class RbacController extends Controller { /** * 编辑角色提交 */ public function roleEditPost() { $id = $this->request->param("id", 0, 'intval'); if ($id == 1) { $this->error("超级管理员角色不能被修改!"); } if ($this->request->isPost()) { $data = $this->request->param(); $result = $this->validate($data, 'role'); if ($result !== true) { // 验证失败 输出错误信息 $this->error($result); } else { if (Db::name('role')->update($data) !== false) { $this->success("保存成功!", url('rbac/index')); } else { $this->error("保存失败!"); } } } } } ```