123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <?php
- # 定义几个常用的选项
- $option = array
- (
- 1 => '正常',
- 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}<br />浏览量:{num_view}+{num_add_view}<br />回复数:{num_review}<br />"',
- //'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', '-='),
- ),
- ),
- ),
- );
|