123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- <?php
- $page = 10;
- $table = array
- (
- 1 => '合集',
- 2 => '合集章节',
- 3 => '合集内容',
- 20 => '主信息',
- 21 => '子信息',
- );
- $table_name = array
- (
- 1 => 'collection/info',
- 2 => 'collection/page',
- 3 => 'collection/content',
- 20 => 'community/info',
- 21 => 'community/info',
- );
- $cate = function()
- {
- $array = array();
- $info = Dever::load('attr/cate-state');
- if($info)
- {
- $array += $info;
- }
- return $array;
- };
- return array
- (
- # 表名
- 'name' => 'info',
- # 显示给用户看的名称
- 'lang' => '社区信息管理',
- # 是否显示在后台菜单
- 'order' => 80,
- 'config' => array
- (
- 'table' => $table,
- 'table_name' => $table_name,
- ),
- # 数据结构
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- 'order' => 'desc',
- //'list' => true,
- ),
-
- 'uid' => array
- (
- 'type' => 'int-11',
- 'name' => '用户名',
- 'default' => '0',
- 'desc' => '请选择用户',
- 'match' => 'is_numeric',
- 'update' => 'text',
- //'search' => 'select',
- 'search' => array
- (
- 'api' => 'passport/user-all',
- 'col' => 'username',
- 'result' => 'id',
- ),
- 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
- ),
- 'cate_id' => array
- (
- 'type' => 'int-11',
- 'name' => '所属类别',
- 'default' => '1',
- 'desc' => '所属类别',
- 'match' => 'is_numeric',
- 'update' => 'select',
- 'option' => $cate,
- //'list' => '{cate_id} > 0 ? Dever::load("attr/cate-one#name", {cate_id}) : "未选择"',
- ),
- 'type' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '所属数据源',
- 'default' => '',
- 'desc' => '所属数据源',
- 'match' => 'option',
- 'option' => $table,
- 'search' => 'select',
- 'update' => 'select',
- 'list' => true,
- ),
-
- 'type_id' => array
- (
- 'type' => 'int-11',
- 'name' => '数据源id',
- 'default' => '',
- 'desc' => '数据源id',
- 'match' => 'option',
- 'update' => 'text',
- ),
- 'type_name' => array
- (
- 'type' => 'varchar-200',
- 'name' => '数据源标题',
- 'default' => '',
- 'desc' => '数据源标题',
- 'match' => 'option',
- 'search' => 'fulltext',
- 'update' => 'text',
- 'list' => true,
- ),
- 'num_up' => array
- (
- 'type' => 'int-11',
- 'name' => '点赞数',
- 'default' => '0',
- 'desc' => '点赞数',
- 'match' => 'option',
- //'search' => 'order',
- 'list' => true,
- ),
- 'num_oppose' => array
- (
- 'type' => 'int-11',
- 'name' => '反对数',
- 'default' => '0',
- 'desc' => '反对数',
- 'match' => 'option',
- //'search' => 'order',
- 'list' => true,
- ),
- 'num_comment' => array
- (
- 'type' => 'int-11',
- 'name' => '评论数',
- 'default' => '0',
- 'desc' => '评论数',
- 'match' => 'option',
- //'search' => 'order',
- 'list' => true,
- ),
-
- 'pic' => array
- (
- 'type' => 'text-255',
- 'name' => '图片-图片尺寸不等,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
- 'default' => '',
- 'desc' => '图片',
- 'match' => 'is_string',
- 'update' => 'images',
- 'key' => '1',
- ),
- 'content' => array
- (
- 'type' => 'text-255',
- 'name' => '内容',
- 'update' => 'editor',
- 'key' => 1,
- 'default' => '',
- 'desc' => '请输入内容',
- 'match' => 'is_string',
- 'search' => 'fulltext',
- //'list' => 'table',
- //'modal' => '查看详情',
- 'list' => 'Dever::load("community/lib/info.content", "{content}", {id})',
- ),
-
- '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,
- 'search' => 'date',
- 'list' => 'date("Y-m-d H:i:s", {cdate})',
- ),
- ),
- 'manage' => array
- (
- //'insert' => false,
- //'edit' => false,
- ),
- # request 请求接口定义
- 'request' => array
- (
- 'getAll' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'uid' => 'yes',
- 'cate_id' => 'yes',
- 'type' => array('yes', 'in'),
- 'type_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('id' => 'desc'),
- 'page' => array($page, 'list'),
- 'col' => '*',
- ),
- 'getHot' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'uid' => 'yes',
- 'cate_id' => 'yes',
- 'type' => array('yes', 'in'),
- 'type_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('num_comment' => 'desc', 'id' => 'desc'),
- 'limit' => '0,1',
- 'col' => '*',
- ),
- )
- );
|