'正常', 2 => '删除', ); return array ( # 表名 'name' => 'review', # 显示给用户看的名称 'lang' => '评论', # 是否显示在后台菜单 'menu' => false, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'order' => 'desc', //'list' => true, ), 'posts_id' => array ( 'type' => 'int-11', 'name' => '主题', 'update' => 'hidden', 'default' => Dever::input('option_posts_id'), 'desc' => '请输入主题', 'match' => 'is_string', //'list' => true, ), 'floor' => array ( 'type' => 'int-11', 'name' => '楼层', 'update' => 'hidden', 'default' => '1', 'desc' => '请输入楼层', 'match' => 'is_string', 'order' => 'asc', 'list' => '"{floor}楼"', ), 'uid' => array ( 'type' => 'int-11', 'name' => '作者', 'default' => '0', 'desc' => '请选择作者', 'match' => 'is_numeric', //'update' => 'select', //'search' => 'select', 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"', ), 'content' => array ( 'type' => 'text-255', 'name' => '内容', 'update' => 'editor', 'key' => 1, 'default' => '', 'desc' => '请输入内容', 'match' => 'is_string', 'search' => 'fulltext', 'list' => 'table', 'modal' => '查看详情', ), 'ip' => array ( 'type' => 'varchar-32', 'name' => 'IP', 'default' => '', 'desc' => '请输入IP', 'match' => 'option', 'update' => 'text', //'search' => 'fulltext', 'list' => true, ), 'num_up' => array ( 'type' => 'int-11', 'name' => '赞数', 'default' => '0', 'desc' => '请填写赞数', 'match' => 'option', //'search' => 'order', //'list' => '"赞数:{num_up}
浏览量:{num_view}+{num_add_view}
回复数:{num_review}
"', //'list_name' => '统计数字', ), 'num_review' => array ( 'type' => 'int-11', 'name' => '回复数', 'default' => '0', 'desc' => '请填写回复数', 'search' => 'order', 'match' => 'option', //'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, ), # request 请求接口定义 'request' => array ( # info 取一条正常的数据 'info' => array ( # 匹配的正则或函数 必填项 'where' => array ( 'floor' => 'yes', 'state' => 1, ), 'type' => 'one', ), # 取总数 /* 'total' => array ( # 匹配的正则或函数 必填项 'where' => array ( 'posts_id' => 'yes', 'state' => 1, ), 'type' => 'count', ), */ # 根据分页排序,取出最新的分页 'new' => array ( # 匹配的正则或函数 选填项 'where' => array ( 'posts_id' => 'yes', ), 'type' => 'all', 'order' => array('floor', 'desc'), 'limit' => array(1, 0), 'col' => 'floor', ), # 更新回复数 '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', '-='), ), ), ), );