array('id' => '-1', 'name' => '父级章节'), ); $info = Dever::db('collection/page')->state(array('info_id' => $info_id, 'page_id' => -1)); if($info) { $array += $info; } return $array; }; $times = function() use ($info_id) { $array = array ( -1 => array('id' => '-1', 'name' => '不选择'), ); $info = Dever::db('collection/times')->mainAll(array('info_id' => $info_id)); if($info) { $array += $info; } return $array; }; $times_child = function() use ($info_id) { $info = Dever::db('collection/times')->childAll(array('info_id' => $info_id)); return $info; }; # 搜索 $search_times = function() use ($info_id) { $array = array ( -1 => array('id' => '-1', 'name' => '所有时光'), ); $info = Dever::load('collection/lib/times')->all(); if($info) { $array += $info; } return $array; }; $bgmusic_autoplay = array ( 1 => '自动播放', 2 => '不自动播放', ); return array ( # 表名 'name' => 'page', # 显示给用户看的名称 'lang' => '章节管理', # 是否显示在后台菜单 'order' => 1, 'menu' => false, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'order' => 'asc', 'list' => true, ), 'info_id' => array ( 'type' => 'int-11', 'name' => '合集', 'default' => '', 'desc' => '合集', 'match' => 'is_numeric', 'update' => 'hidden', 'search' => 'hidden', 'value' => $info_id ), 'source_id' => array ( 'type' => 'int-11', 'name' => '来源id-一般为采集器的采集规则id,用以区分导入的数据是否重复', 'default' => '-1', 'desc' => '来源id', 'match' => 'is_numeric', ), 'name' => array ( 'type' => 'varchar-150', 'name' => '章节名称', 'default' => '', 'desc' => '章节名称', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, 'edit' => true, ), 'times_id_parent' => array ( 'type' => 'int-11', 'name' => '父级时光', 'default' => '0', 'desc' => '请选择父级时光', 'match' => 'is_numeric', 'update' => 'select', 'option' => $times, # 当值改变时,执行下一步操作 'child_name' => 'times_id', 'child' => $times_child, 'child_value' => '{times_id}', ), 'times_id' => array ( 'type' => 'int-11', 'name' => '子时光', 'default' => '0', 'desc' => '请选择子时光', 'match' => 'is_numeric', 'search' => 'group', 'option' => $search_times, 'list_name' => '时光', 'list' => '{times_id} > 0 ? Dever::load("collection/lib/times.getName", {times_id}, {times_id_parent}) : "无"', ), 'page_id' => array ( 'type' => 'int-11', 'name' => '上级章节', 'default' => $page_id, 'desc' => '请选择上级章节', 'match' => 'is_numeric', 'update' => $page_id < 0 ? 'hidden': 'select', 'option' => $page, //'value' => $page_id, 'list' => '{page_id} > 0 ? Dever::load("collection/page-one#name", {page_id}) : "主章节"', ), 'bgmusic' => array ( 'type' => 'varchar-800', 'name' => '背景音乐-音频格式mp3,上传大小不能超过100M', 'default' => '', 'desc' => '背景音乐', 'match' => 'option', 'update' => 'upload', 'key' => '2', 'place' => '150', 'upload' => 'yun', 'large' => true, ), 'bgmusic_autoplay' => array ( 'type' => 'tinyint-1', 'name' => '背景音乐自动播放', 'default' => '1', 'desc' => '背景音乐自动播放', 'match' => 'option', 'update' => 'radio', 'option' => $bgmusic_autoplay, ), 'pic' => array ( 'type' => 'varchar-150', 'name' => '图片-章节图片,一般作为开头的封面图片,尺寸为330*330px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => '章节图片', 'match' => 'option', 'update' => $page_id < 0 ? 'hidden': 'image', 'key' => '1', 'place' => '330*330', ), 'desc' => array ( 'type' => 'varchar-800', 'name' => '描述-添加描述将展示封面', 'default' => '', 'desc' => '描述', 'match' => 'option', 'update' => 'textarea', 'update' => $page_id < 0 ? 'hidden': 'textarea', //'list' => true, ), 'desc_end' => array ( 'type' => 'varchar-800', 'name' => '完结描述-添加完结描述将展示在本章节末尾', 'default' => '', 'desc' => '描述', 'match' => 'option', 'update' => 'textarea', 'update' => $page_id < 0 ? 'hidden': 'textarea', //'list' => true, ), 'pic_end' => array ( 'type' => 'varchar-150', 'name' => '完结图片-章节图片,一般作为结尾的封面图片,尺寸为330*330px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => '完结图片', 'match' => 'option', 'update' => $page_id < 0 ? 'hidden': 'image', 'key' => '1', 'place' => '330*330', ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序(数值越小越靠前)', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', 'update' => 'text', 'search' => 'order', 'list_name' => '排序', 'list' => true, 'order' => 'asc', 'edit' => true, ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', ), 'cdate' => array ( 'type' => 'int-11', 'name' => '录入时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, 'order' => 'asc', //'search' => 'date', 'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), 'manage' => array ( 'edit' => false, 'button' => array ( '时光配置' => array('location', 'manage/project/database/list&project=collection&oper_table=page&top_table=info&top_project=collection&table=times&search_option_info_id=' . $info_id . '&search_option_state=1'), ), # 列表页的类型 'list_type' => 'tree', 'list_button' => array ( //'update' => '编辑', 'update' => array('编辑', '"page&option_page_id={page_id}"'), 'add' => array('新增子章节', '"{page_id}" == -1 ? "page&option_page_id={id}" : "page&option_page_id={page_id},{id}"', '{page_id} == -1'), 'list' => array('内容管理', '"content&search_option_info_id={info_id}&send_page_id={id}&oper_table=page&top_table=info&top_project=collection&page_type=1"' , '{page_id} > 0'), 'delete' => '删除', ), ), 'request' => array ( 'child' => array ( 'option' => array ( 'state' => 1, 'page_id' => array(1, '>='), 'info_id' => 'yes', 'times_id' => 'yes', ), 'type' => 'all', 'order' => array('reorder' => 'asc', 'id' => 'asc'), 'col' => '*', ), 'main' => array ( 'option' => array ( 'state' => 1, 'page_id' => -1, 'info_id' => 'yes', 'times_id' => 'yes', ), 'type' => 'all', 'order' => array('reorder' => 'asc', 'id' => 'asc'), 'col' => '*', ), 'getOne' => array ( 'option' => array ( 'page_id' => array(1, '>='), 'info_id' => 'yes', 'times_id' => 'yes', 'state' => 1, ), 'type' => 'one', 'order' => array('reorder' => 'asc', 'id' => 'asc'), 'col' => '*', ), 'getNew' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'info_id' => 'yes', 'page_id' => 'yes', 'state' => 1, ), 'type' => 'one', 'order' => array('reorder' => 'desc', 'cdate' => 'desc'), 'col' => '*', ), ) );