123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 |
- <?php
- $audit = Dever::config('base')->audit;
- $status = Dever::config('base')->status;
- $config = array
- (
- # 表名
- 'name' => 'info',
- # 显示给用户看的名称
- 'lang' => '资源列表',
- 'order' => 200,
- 'auto' => 10000000,
- 'end' => array
- (
- 'insert' => 'res/lib/manage.infoUpdate',
- 'update' => 'res/lib/manage.infoUpdate',
- ),
- # 同步更新另外一个或多个表的数据,将数据同步到关联表中
- 'sync' => array
- (
- 'res/info_category' => array
- (
- # 更新另外一个表的字段 => 本表的字段
- 'where' => array('info_id', 'id'),
- # 要更新的数据
- 'update' => array('category_id' => 'category'),
- # 同步更新的类型,delete为先删再插入,update为直接更新
- 'type' => 'delete',
- )
- ),
- # 数据结构 不同的字段放这里
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- //'list' => true,
- ),
- 'name' => array
- (
- 'type' => 'varchar-800',
- 'name' => '标题',
- 'default' => '',
- 'desc' => '标题',
- 'match' => 'is_string',
- 'update' => 'textarea',
- 'search' => 'fulltext',
- //'list' => true,
- //'edit' => true,
- ),
- 'category' => array
- (
- 'type' => 'varchar-500',
- 'name' => '分类',
- 'default' => '',
- 'desc' => '分类',
- 'match' => 'is_string',
- 'search' => 'linkage',
- 'update' => 'linkage',
- 'option' => Dever::url('api.get', 'category'),
- //'list' => 'Dever::load("category/api.string", "{category}")',
- ),
- # 以下几个分类其实在关联表中已经有了,放到这里是为了查询方便,一般只有三级分类,多了就从关联表查询吧
- 'top_category_id' => array
- (
- 'type' => 'int-11',
- 'name' => '顶级分类ID-顶级分类,用于分类查询',
- 'default' => '-1',
- 'desc' => '顶级分类ID',
- 'match' => 'is_numeric',
- ),
- 'second_category_id' => array
- (
- 'type' => 'int-11',
- 'name' => '二级分类ID-二级分类,用于分类查询',
- 'default' => '-1',
- 'desc' => '二级分类ID',
- 'match' => 'is_numeric',
- ),
- 'category_id' => array
- (
- 'type' => 'int-11',
- 'name' => '子分类ID-最后一个级别的分类,用于分类查询',
- 'default' => '-1',
- 'desc' => '子分类ID',
- 'match' => 'is_numeric',
- ),
- 'pic_cover' => array
- (
- 'type' => 'varchar-150',
- 'name' => '封面图-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪',
- 'default' => '',
- 'desc' => '封面图',
- 'match' => 'option',
- 'update' => 'image',
- 'key' => '1',
- 'place' => '150',
- 'list_name' => '资源详情',
- 'list' => 'Dever::load("res/lib/manage.info", "{id}")',
- ),
- 'pic' => array
- (
- 'type' => 'text-255',
- 'name' => '多张图片-图片尺寸随意,一般为用户上传,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
- 'default' => '',
- 'desc' => '多张图片',
- 'match' => 'option',
- 'update' => 'images',
- 'key' => '1',
- ),
- 'num_view' => array
- (
- 'type' => 'int-11',
- 'name' => '阅读数',
- 'default' => '0',
- 'desc' => '请填写阅读数',
- 'match' => 'option',
- 'search' => 'order',
- 'list' => '{num_view}+{num_add_view}',
- ),
- 'num_add_view' => array
- (
- 'type' => 'int-11',
- 'name' => '阅读数基数',
- 'default' => '0',
- 'desc' => '阅读数基数',
- 'match' => 'option',
- //'update' => 'text',
- ),
- 'uid' => array
- (
- 'type' => 'int-11',
- 'name' => '创建人',
- 'default' => '-1',
- 'desc' => '创建人',
- 'match' => 'is_numeric',
- 'update' => 'text',
- 'search' => array
- (
- 'api' => 'passport/user-all',
- 'col' => 'username',
- 'result' => 'id',
- ),
- ),
- 'audit' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '审核',
- 'default' => '2',
- 'desc' => '审核',
- 'match' => 'is_numeric',
- //'update' => 'select',
- 'option' => $audit,
- 'search' => 'select',
- 'list' => true,
- 'edit' => true,
- ),
- 'status' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '状态',
- 'default' => '1',
- 'desc' => '状态',
- 'match' => 'is_numeric',
- //'update' => 'select',
- 'option' => $status,
- 'search' => 'select',
- 'list' => true,
- 'edit' => true,
- ),
- 'admin_editor' => array
- (
- 'type' => 'int-11',
- 'name' => '后台操作人',
- 'default' => '1',
- 'desc' => '后台操作人',
- 'match' => 'is_numeric',
- ),
- 'reorder' => array
- (
- 'type' => 'int-11',
- 'name' => '排序-数值越大越靠前,相当于置顶',
- 'default' => '1',
- 'desc' => '请输入排序',
- 'match' => 'option',
- //'update' => 'text',
- 'search' => 'order',
- 'list' => true,
- 'order' => 'desc',
- 'edit' => true,
- ),
- 'udate' => array
- (
- 'type' => 'int-11',
- 'name' => '更新时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- ),
- 'content' => array
- (
- 'type' => 'text-800',
- 'name' => '内容',
- 'default' => '',
- 'desc' => '内容',
- 'match' => 'is_string',
- //'update' => 'editor',
- 'key' => '1',
- ),
- '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})',
- ),
- ),
- # 索引
- 'index' => array
- (
- 1 => array
- (
- 'search' => 'uid,category,top_category_id,second_category_id,category_id',
- ),
-
- # 版本号 更改版本号会更新当前表的索引
- 'version' => 1,
- ),
-
- # 管理功能
- 'manage' => array
- (
- // 载入自定义资源 路径可以配置在config里。这里没有写路径。demo.css
- 'res' => array
- (
- //'css' => 'demo',
- ),
- //'insert' => false,
- //'delete' => false,
- 'mul' => true,
- # 自定义快捷新增和编辑
- 'button' => array
- (
- //'类别管理' => array('list', 'cate&project=demand&search_option_key=cate&search_option_tablename=类别&oper_parent=info&oper_project=demand'),
- ),
- # 列表里的按钮
- 'list_button' => array
- (
- 'add' => array('属性设置', '"info_attr
- &project=res
- &search_option_info_id={id}
- &search_option_category={category}
- &oper_parent=info&oper_project=res
- &oper_save_jump=info
- &where_id={id}"'),
- 'br1' => array('<br />'),
- 'delete' => '删除',
- ),
- ),
- # request 请求接口定义
- 'request' => array
- (
- # 后台搜索用到
- 'search' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'ids' => array('yes-id', 'in'),
- 'name' => array('yes', 'like'),
- 'id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder' => 'desc', 'id' => 'desc'),
- 'limit' => '0,1000',
- 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
- ),
- # 列表
- 'getAll' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'audit' => 2,
- 'category' => array('yes', 'like'),
- 'top_category_id' => 'yes',
- 'second_category_id' => 'yes',
- 'category_id' => 'yes',
- //'status' => 1,
- //'poster_pay_type' => 2,
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder' => 'desc', 'id' => 'desc'),
- 'limit' => '0,10',
- //'page' => array(10, 'list'),
- 'col' => '*',
- ),
- # 分页
- 'getPageAll' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'uid' => 'yes',
- 'name' => array('yes', 'like'),
- 'audit' => 2,
- 'category' => array('yes', 'like'),
- 'top_category_id' => 'yes',
- 'second_category_id' => 'yes',
- 'category_id' => 'yes',
- //'status' => 1,
- //'poster_pay_type' => 2,
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('reorder' => 'desc', 'id' => 'desc'),
- 'page' => array(10, 'list'),
- 'col' => '*',
- ),
-
- # 更新浏览量
- 'addView' => array
- (
- 'type' => 'update',
- 'where' => array
- (
- 'id' => 'yes',
- ),
- 'set' => array
- (
- 'num_view' => array('1', '+='),
- ),
- ),
- ),
- );
- return $config;
|