企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
以API模块分组管理为例 ~~~ <?php namespace app\api\admin; use app\testing\admin\Base; class ApiGroup extends Base { /** * 分组列表 * 2017-12-7 下午9:50:09 * qw_xingzhe <qwei2013@gmail.com> */ public function index() { $list = DBuilder('ApiGroup')->quickEdit() // 允许快虚编辑 ->filter([ // 设置过滤字段 ['keyword','%%','title|simp_desc'], ]) ->rememberUri() // 记住当前页面地址,当下一个页面操作后需要跳转上一个页面时,将使用此地址 ->setOrder('id desc') // 指定排序规则 ->getLists(); // 指定查询条件,获取列表结果 return TBuilder('table')->setRowList($list) // 设置表格数据 ->addFilters([ // 添加文本输入筛选筛选 ['keyword|input','请输入关键词'], ]) ->addTopButton([ 'type' => 'add', 'popup' => true, 'attr' => ['modal-wh'=>'480|300'], ]) ->addTopButton([ 'type' => 'del', ]) ->setColumns([ // 批量设置数据列 ['id', 'ID'], ['title.text', '名称'], ['simp_desc.textarea', '描述'], ['', '操作', ['type'=>'btn']] ]) ->addListButton([ 'type' => 'edit', 'popup' => true, 'attr' => ['modal-wh'=>'480|300'], ]) ->addListButton([ 'type' => 'del', ]) ->fetch(); } /** * 编辑分组 * 2017-12-7 下午8:25:12 * qw_xingzhe <qwei2013@gmail.com> */ public function edit($id) { return $this->add( $id ); } /** * 新增分组 * 2017-12-7 下午8:25:05 * qw_xingzhe <qwei2013@gmail.com> */ public function add( $id=0 ) { $info = DBuilder('ApiGroup')->setEdit()->getInfo( $id ); return TBuilder('form',$this) ->addWidgets([ ['title|text', '分组名称|分组名称必须'], ['simp_desc|textarea', '描述'], ['id|hidden'], ]) ->hideWidgetsDesc() ->setWidgetsValues( $info ) ->fetch(); } /** * 删除分组 * 2017-12-7 下午9:45:14 * qw_xingzhe <qwei2013@gmail.com> */ public function del($id){ // 物理删除 // DBuilder('ApiGroup')->deleteTrue($id); // 逻辑删除 DBuilder('ApiGroup')->deleteSoft($id); } } ~~~