'发布', 2 => '未发布', ); $channel = function() { $array = array(); $channel = Dever::db('atom/channel')->parent(); if ($channel) { $array += $channel; } return $array; }; $channel_child = function() { $channel = Dever::db('atom/channel')->child(); return $channel; }; # 栏目 $search_channel = function() { $array = array ( -1 => array('id' => '-1', 'name' => '所有栏目'), ); $channel = Dever::load('atom/service/article/channel.all'); if ($channel) { $array += $channel; } return $array; }; return array ( # 表名 'name' => 'article', # 显示给用户看的名称 'lang' => '文章', 'order' => 20, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', 'list' => true, ), 'name' => array ( 'type' => 'varchar-80', 'name' => '标题', 'default' => '', 'desc' => '请输入主题标题', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, ), 'author' => array ( 'type' => 'varchar-80', 'name' => '作者-请填写用户id', 'default' => '1', 'desc' => '请填写作者', 'match' => 'is_string', 'update' => 'text', //'search' => 'select', 'list' => true, ), 'channel_id_parent' => array ( 'type' => 'int-11', 'name' => '父级栏目', 'default' => '0', 'desc' => '请选择父级栏目', 'match' => 'is_numeric', 'update' => 'select', //'search' => 'order,select', //'list' => '{channel_id_parent} > 0 ? Dever::load("atom/channel-one#name", {channel_id_parent}) : "临时栏目"', 'option' => $channel, # 当值改变时,执行下一步操作 'child_name' => 'channel_id', 'child' => $channel_child, 'child_value' => '{channel_id}', ), 'channel_id' => array ( 'type' => 'int-11', 'name' => '子栏目', 'default' => '0', 'desc' => '请选择子栏目', 'match' => 'is_numeric', //'search' => 'order', 'list_name' => '栏目', 'list' => '{channel_id} > 0 ? Dever::load("atom/channel-one#name", {channel_id}) : "无子栏目"', ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序(数值越大越靠前)', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', 'update' => 'text', 'search' => 'order', 'list_name' => '排序', 'list' => true, 'order' => 'desc', 'edit' => true, ), 'pic' => array ( 'type' => 'varchar-200', 'name' => '封面标准图-请上传等比例图片300X300', 'default' => '', 'desc' => '封面标准图', 'match' => 'is_string', 'update' => 'image', 'key' => 1 ), 'content' => array ( 'type' => 'text-255', 'name' => '内容', 'default' => '', 'desc' => '请输入内容', 'match' => 'is_string', 'update' => 'editor', 'key' => 1, ), 'status' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', 'option' => $option, 'update' => 'radio', 'list' => 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, 'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), # 管理功能 'manage' => array ( //'insert' => false, # 列表 'list' => array ( array ( 1 => array('分页', '"page&option_article_id={id}"') ), ), ), # request 请求接口定义 'request' => array ( # 获取默认主题,按照置顶和时间排序的 'default' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'cate_id' => 'yes', 'cate_id_parent' => 'yes', 'uid' => 'yes', ), 'type' => 'all', 'order' => array('top' => 'desc', 'reorder' => 'desc', 'id' => 'desc'), 'page' => array(15, 'list'), 'col' => '*', ), # 更新浏览量 'addView' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'num_view' => array('1', '+='), ), ), # 更新回复数 'addReview' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'num_review' => array('1', '+='), ), ), # 更新点赞数 'addUp' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'num_up' => array('1', '+='), ), ), # 更新点赞数 'desUp' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'num_up' => array('1', '-='), ), ), ), );