'普通', 2 => '封禁', ); $role = function() { return Maze::load('/role-all'); }; $config = function() { return Maze::load('/config-all'); }; return array ( # 表名 'name' => 'admin', # 显示给用户看的名称 'lang' => '管理账户设置', /* # 用到哪个后台菜单上,对应项目的key 'menu' => 'project_niuyou_main', # 后台菜单排序 'order' => 10, # 显示到后台快捷发布中,值为排序 'fast' => 1, */ 'order' => 9, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => '管理员ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', 'list' => true, ), 'username' => array ( 'type' => 'varchar-24', 'name' => '管理员名', 'default' => '', 'desc' => '请输入管理员名', 'match' => 'is_string', 'update' => 'text', //'autocomplete' => 'auth.role?json=1', 'search' => 'order,fulltext', 'list' => true, ), 'password' => array ( 'type' => 'varchar-32', 'name' => '管理员密码', 'default' => '', 'desc' => '请输入管理员密码', 'match' => 'option', 'update' => 'password', 'callback' => 'md5', ), 'config' => array ( 'type' => 'int-11', 'name' => '后台配置', 'default' => '1', 'desc' => '请选择后台配置', 'match' => 'is_numeric', 'option' => $config, 'update' => 'select', 'list' => true, ), 'role' => array ( 'type' => 'varchar-100', 'name' => '角色', 'default' => '1', 'desc' => '请选择角色', 'match' => 'is_string', 'option' => $role, 'update' => 'checkbox', //'list' => true, ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', 'option' => $option, 'update' => 'radio', 'list' => true, ), 'cdate' => array ( 'type' => 'int-11', 'name' => '录入时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, 'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), # 更新表结构 'alter' => array ( 2 => array ( array('update', 'role', 'role', 'varchar-100 1 角色'), array('add', 'config', 'config', 'int-11 1 配置'), ), 'version' => 2, ), # 默认值 'default' => array ( 'col' => 'username,password,role,state,cdate', 'value' => array ( '"admin","'. md5('admin123') . '",1, 1,' . time(), ), ), # 索引 'index' => array ( # 索引名 => 索引id //'id' => 'id,state', ), # request 请求接口定义 'request' => array ( # one 根据用户名和密码取一条数据 'user' => array ( # 匹配的正则或函数 必填项 'where' => array ( //'username' => '/^([A-Za-z0-9])/', 'username' => 'is_string', //'password' => 'is_string', ), 'type' => 'one', ), # 更新密码 'password' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'password' => 'yes', ), ), ), );