audit; $status = Dever::config('base')->status; # 分类权限 $auth = Dever::tops(); $cate = function() use ($auth) { $array = array(); if ($auth) { $info = Dever::db('collection/cate')->getIds(array('ids' => $auth)); } else { $info = Dever::db('collection/cate')->state(); } if($info) { $array += $info; } return $array; }; $author = function() { $array = array ( -1 => array ( 'id' => -1, 'name' => '未选择', ) ); $info = Dever::db('collection/author')->state(); if($info) { $array += $info; } return $array; }; $score = function() { $array = array(); $info = Dever::db('score/config')->state(array('type' => 3)); if($info) { $array += $info; } return $array; }; $top = array ( 1 => '推荐', 2 => '不推荐', ); $score_type = array ( 1 => '全局积分', 2 => '私有积分', ); $buy = array ( 1 => '收费', 2 => '免费', ); $page = 15; # 常用的col $col = '*'; $config = array ( # 表名 'name' => 'info', # 显示给用户看的名称 'lang' => '合集列表', 'order' => 100, 'end' => array ( 'insert' => 'collection/lib/manage.setInfo', 'update' => 'collection/lib/manage.setInfo', 'update_status' => 'collection/lib/manage.setInfo', 'update_top' => 'collection/lib/manage.setTop', ), # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'list' => true, ), 'hr1' => array ( 'name' => '基本配置', 'class' => '',//本项必须填写 'attr' => '', ), 'name' => array ( 'type' => 'varchar-180', 'name' => '标题-分享时作为默认标题', 'default' => '', 'desc' => '标题', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, ), 'cate_id' => array ( 'type' => 'int-11', 'name' => '分类', 'default' => '1', 'desc' => '分类', 'match' => 'is_numeric', 'update' => 'select', 'option' => $cate, 'search' => 'select', 'list' => true, ), 'desc' => array ( 'type' => 'varchar-800', 'name' => '描述-分享时作为默认描述', 'default' => '', 'desc' => '描述', 'match' => 'option', 'update' => 'textarea', //'list' => true, ), 'pic_cover' => array ( 'type' => 'varchar-150', 'name' => '封面图-用作列表页的图片,也用作分享默认图片,图片尺寸660*660px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => '封面图', 'match' => 'option', 'update' => 'image', 'key' => '1', 'place' => '660*660', ), 'logo' => array ( 'type' => 'varchar-150', 'name' => 'LOGO图片-图片尺寸150*150px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => 'LOGO图片', 'match' => 'option', //'update' => 'image', 'key' => '1', 'place' => '150*150', ), 'pic_bg' => array ( 'type' => 'text-255', 'name' => '首页头图-可以上传多张,展示在合集首页,图片尺寸414*374px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => '首页头图', 'match' => 'option', 'update' => 'images', 'key' => '1', 'place' => '414*374', ), 'bgmusic' => array ( 'type' => 'varchar-800', 'name' => '背景音乐-音频格式mp3,上传大小不能超过100M', 'default' => '', 'desc' => '背景音乐', 'match' => 'option', //'update' => 'upload', 'key' => '2', 'place' => '150', 'upload' => 'yun', 'large' => true, ), 'pdate' => array ( 'type' => 'int-11', 'name' => '开始时间', 'match' => array('is_numeric', time()), 'default' => '', 'desc' => '', //'update' => 'date', 'callback' => 'maketime', 'insert' => true, //'list' => 'date("Y-m-d H:i:s", {pdate})', 'auth' => '"{pdate}" > 0', ), 'content' => array ( 'type' => 'text-255', 'name' => '内容介绍-内容介绍显示在合集首页', 'default' => "", 'desc' => '请输入内容', 'match' => 'is_string', 'update' => 'editor', 'key' => 1, //'show' => 'buy=1', ), 'hr22' => array ( 'name' => '作者配置', 'class' => '',//本项必须填写 'attr' => '', ), 'author_name' => array ( 'type' => 'varchar-50', 'name' => '作者称谓-默认为作者,可以改为店主之类的', 'default' => '作者', 'desc' => '作者称谓', 'match' => 'option', 'update' => 'text', ), 'uid' => array ( 'type' => 'int-11', 'name' => '作者关联用户', 'default' => '0', 'desc' => '请选择关联用户', 'match' => 'is_numeric', 'update' => 'select', 'update_search' => 'passport/lib/manage.search', //'search' => 'select', 'search' => array ( 'api' => 'passport/user-all', 'col' => 'username', 'result' => 'id', ), //'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "官方"', ), 'author' => array ( 'type' => 'varchar-50', 'name' => '作者姓名-为空则直接读取关联用户的用户名', 'default' => '', 'desc' => '作者姓名', 'match' => 'option', 'update' => 'text', ), 'author_logo' => array ( 'type' => 'varchar-150', 'name' => '作者头像-为空则直接读取关联用户的头像', 'default' => '', 'desc' => '作者头像', 'match' => 'option', 'update' => 'image', 'key' => '1', 'place' => '150*150', ), 'hr2' => array ( 'name' => '积分与门票', 'class' => '',//本项必须填写 'attr' => '', ), 'score_id' => array ( 'type' => 'int-11', 'name' => '积分配置名称', 'default' => '', 'desc' => '积分配置名称', 'match' => 'is_numeric', 'update' => 'select', 'option' => $score, ), 'score_type' => array ( 'type' => 'int-11', 'name' => '是否全局积分-全局积分就是与所有设置全局积分的合集共享一个积分,私有积分就是单独计算积分', 'default' => '1', 'desc' => '是否全局积分', 'match' => 'option', 'update' => 'radio', 'option' => $score_type, 'control' => 'score_type', ), 'score_name' => array ( 'type' => 'varchar-180', 'name' => '积分自定义名称-仅私有积分可以设置,修改后,将替换积分配置名称,但具体积分规则无法替换', 'default' => '', 'desc' => '积分自定义名称', 'match' => 'option', 'update' => 'text', 'show' => 'score_type=2', ), 'ticket_name' => array ( 'type' => 'varchar-50', 'name' => '门票名称-可以自定义门票的名称', 'default' => '门票', 'desc' => '门票名称', 'match' => 'option', 'update' => 'text', ), 'unit' => array ( 'type' => 'varchar-80', 'name' => '门票单位-默认为张', 'default' => '张', 'desc' => '门票单位', 'match' => 'option', 'update' => 'text', //'list' => true, ), 'hr3' => array ( 'name' => '入口配置', 'class' => '',//本项必须填写 'attr' => '', ), 'password' => array ( 'type' => 'varchar-50', 'name' => '密码-输入密码后,进入合集必须输入密码', 'default' => '', 'desc' => '密码', 'match' => 'option', 'update' => 'text', ), 'password_name' => array ( 'type' => 'varchar-50', 'name' => '密码名称-可以自定义密码的名称', 'default' => '密码', 'desc' => '密码', 'match' => 'option', 'update' => 'text', ), 'buy' => array ( 'type' => 'int-11', 'name' => '是否收费-收费将在进入合集时,验证是否购买,免费不验证', 'default' => '1', 'desc' => '是否收费', 'match' => 'option', 'update' => 'radio', 'option' => $buy, 'control' => 'buy', //'list' => true, 'search' => 'select', ), 'num_buy' => array ( 'type' => 'int-11', 'name' => '购买数', 'default' => '0', 'desc' => '请填写购买数', 'match' => 'option', 'search' => 'order', //'show' => 'buy=1', 'list' => 'Dever::load("collection/lib/manage.num?id={id}")', 'list_name' => '统计数字', ), 'num_ratio_buy' => array ( 'type' => 'varchar-20', 'name' => '购买系数-用以增加总购买量,系数不能小于等于0,支持两位小数,总购买量=(用户当前购买数+购买基数)*购买系数。', 'default' => '1', 'desc' => '手动增加购买系数', 'match' => 'is_string', 'update' => 'text', //'show' => 'buy=1', ), 'num_add_buy' => array ( 'type' => 'int-11', 'name' => '购买基数', 'default' => '0', 'desc' => '手动增加阅读数', 'match' => 'option', 'update' => 'text', //'show' => 'buy=1', ), 'num_add_view' => array ( 'type' => 'int-11', 'name' => '阅读数基数', 'default' => '0', 'desc' => '手动增加阅读数', 'match' => 'option', 'update' => 'text', //'show' => 'buy=2', ), 'num_view' => array ( 'type' => 'int-11', 'name' => '阅读数', 'default' => '0', 'desc' => '请填写阅读数', 'match' => 'option', 'search' => 'order', ), 'buy_price' => array ( 'type' => 'varchar-50', 'name' => '门票单张支付价格-单位元,直接填写数字即可', 'default' => '10', 'desc' => '支付价格', 'match' => 'is_string', 'update' => 'text', //'show' => 'buy=1', ), 'buy_content' => array ( 'type' => 'text-255', 'name' => '购买说明-门票可以用{ticket_name}代替,将自动替换为设置的名称,{name}为合集名称', 'default' => "

1、{ticket_name}购买成功后可直接进入{name}; 

2、{ticket_name}为虚拟商品,如无系统问题,购买后不可退款;  

3、购买后可参与排行榜,榜上有名者可获得相应奖励,具体规则参考排行榜说明; 

4、当购买成功后,系统会自动使用一个{ticket_name},多余可赠送好友; 

5、好友使用你的{ticket_name}后,将成为你的永久伙伴,伙伴任何行为都会为你带来一定影响;

", 'desc' => '请输入内容', 'match' => 'is_string', 'update' => 'editor', 'key' => 1, //'show' => 'buy=1', ), 'audit' => array ( 'type' => 'int-11', 'name' => '审核', 'default' => '1', 'desc' => '审核', 'match' => 'is_numeric', //'update' => 'select', 'option' => $audit, //'search' => 'select', //'list' => true, //'edit' => true, ), 'top' => array ( 'type' => 'int-11', 'name' => '推荐', 'default' => '2', 'desc' => '推荐', 'match' => 'is_numeric', //'update' => 'select', 'option' => $top, 'search' => 'select', 'list' => true, 'edit' => true, ), 'status' => array ( 'type' => 'int-11', 'name' => '上线状态', 'default' => '2', 'desc' => '上线状态', 'match' => 'is_numeric', //'update' => 'select', 'option' => $status, 'search' => 'select', 'list' => true, 'edit' => true, ), /* 'hr4' => array ( 'name' => '首页按钮配置', 'class' => '',//本项必须填写 'attr' => '', ), 'button' => array ( 'type' => 'varchar-100', 'name' => '首页按钮名称配置-仅有两个按钮,用逗号隔开,第一个是入口,第二个是排行榜,这里仅能修改按钮名称', 'default' => '入口,排行榜', 'desc' => '首页按钮名称配置', 'match' => 'is_string', //'update' => 'text', ), 'button_ftcolor' => array ( 'type' => 'varchar-10', 'name' => '首页按钮文字颜色-默认为白色', 'default' => '#ffffff', 'desc' => '首页按钮文字颜色', 'match' => 'is_string', //'update' => 'color', ), 'button_bgcolor' => array ( 'type' => 'varchar-10', 'name' => '首页按钮背景颜色配置-默认为黑色', 'default' => '#000000', 'desc' => '首页按钮背景颜色配置', 'match' => 'is_string', //'update' => 'color', ), 'button_bgjcolor' => array ( 'type' => 'varchar-10', 'name' => '首页按钮背景渐变颜色配置-默认为黑色', 'default' => '#000000', 'desc' => '首页按钮背景渐变颜色配置', 'match' => 'option', //'update' => 'color', ), */ 'hr5' => array ( 'name' => '分享配置', 'class' => '',//本项必须填写 'attr' => '', ), 'share_name' => array ( 'type' => 'varchar-50', 'name' => '分享者称谓-默认为分享者', 'default' => '分享者', 'desc' => '分享者称谓', 'match' => 'option', 'update' => 'text', ), 'share_title' => array ( 'type' => 'varchar-100', 'name' => '分享标题-{name}为合集标题,{username}为当前合集用户名', 'default' => '', 'desc' => '分享标题', 'match' => 'option', 'update' => 'text', ), 'share_pic' => array ( 'type' => 'varchar-150', 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => '分享图片', 'match' => 'option', 'update' => 'image', 'key' => '1', 'place' => '150', //'upload' => 'qiniu', //'large' => true, ), 'share_content' => array ( 'type' => 'varchar-200', 'name' => '分享内容', 'default' => '', 'desc' => '分享内容', 'match' => 'option', 'update' => 'textarea', ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序(数值越大越靠前)', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', //'update' => 'text', 'search' => 'order', 'list' => true, 'order' => 'desc', 'edit' => true, ), 'admin_founder' => array ( 'type' => 'int-11', 'name' => '创建人', 'default' => '1', 'desc' => '创建人', 'match' => 'is_numeric', ), 'admin_editor' => array ( 'type' => 'int-11', 'name' => '操作人', 'default' => '1', 'desc' => '操作人', 'match' => 'is_numeric', ), 'udate' => array ( 'type' => 'int-11', 'name' => '更新时间', 'match' => array('is_numeric', time()), 'desc' => '', ), '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, ), ), 'top' => Dever::config('base')->top, # 增加这个,为了给当前的list增加一个option $admin = Dever::load('manage/auth.info'); 'top_option' => array ( array ( 'value' => $auth, 'col' => 'cate_id', ), array ( 'value' => Dever::load('manage/auth.authData'), 'col' => 'id', ), ), # 更新表结构 /* 'alter' => array ( 2 => array ( //array('update', 'role', 'role', 'varchar-100 1 角色'), array('add', 'unit', 'unit', 'varchar-80 张 单位'), ), 'version' => 2, ), */ # 管理功能 'manage' => array ( //'insert' => false, 'delete' => false, # 列表 'list_button' => array ( 'update' => '编辑', 'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('collection/lib/manage.preview?type=1'))), 'list0' => array('按钮', '"button&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'), 'br2' => array('
'), 'list1' => array('功能', '"function&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'), 'list2' => array('门票', '"buy&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'), 'list3' => array('项目', '"object&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'), 'br3' => array('
'), //'list5' => array('章节', '"page&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'), 'list5' => array('内容', '"times&search_option_info_id={id}&oper_table=info"' , '{audit} == 1'), 'list6' => array('榜单', '"ranking&project=collection&search_option_info_id={id}&oper_table=info&oper_project=collection&where_id={id}"', '{audit} == 1'), 'list7' => array('反馈', '"feedback&project=user&search_option_info_id={id}&oper_table=info&oper_project=collection"'), ), ), # request 请求接口定义 'request' => array ( 'search' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'ids' => array('yes-id', 'in'), 'cate_id' => 'yes', 'name' => array('yes', 'like'), 'id' => 'yes', 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'pdate' => '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, 'buy' => 'yes', 'cate_id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'pdate' => 'desc', 'id' => 'desc'), //'page' => array(10, 'list'), 'col' => $col, ), 'getAllByPage' => array ( # 匹配的正则或函数 选填项 'option' => array ( //'audit' => 2, 'cate_id_1' => array('yes-cate_id', '=', 'and('), 'time' => array('yes-pdate', '<=', 'or)'), 'buy' => 'yes', 'cate_id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'pdate' => 'desc', 'id' => 'desc'), 'page' => array(10, 'list'), 'col' => $col, ), # 更新浏览量 'addView' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'num_view' => array('1', '+='), ), ), # 更新购买量 'addBuy' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'num_buy' => array('1', '+='), ), ), 'getIds' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'cate_id' => array('yes-cate_id', 'in'), 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'pdate' => 'desc','id' => 'desc'), 'col' => '*,id as value|id', ), 'getOne' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'id' => 'yes', 'state' => 1, ), 'type' => 'one', 'col' => $col, ), # 热门 'getHot' => array ( # 匹配的正则或函数 选填项 'option' => array ( //'audit' => 2, 'top' => 1, 'buy' => 'yes', 'time' => array('yes-pdate', '<=', 'or)'), 'cate_id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('reorder' => 'desc', 'pdate' => 'desc', 'id' => 'desc'), 'page' => array(10, 'list'), 'col' => 'id,name,`desc`,pic_cover', ), 'getNew' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'cate_id_1' => array('yes-cate_id', '=', 'and('), 'time' => array('yes-pdate', '<=', 'or)'), 'cate_id' => 'yes', 'status' => 1, 'state' => 1, ), 'type' => 'one', 'order' => array('ssdate' => 'desc'), 'col' => $col . ',case when cate_id = 1 then pdate else pdate-'.$time.' end as ssdate', ), ), ); /* 由top_option取代 if ($auth) { $config['request']['list'] = array ( 'type' => 'all', 'order' => array('id' => 'desc'), 'col' => '*|id', 'page' => array(15, 'list'), 'option' => array ( 'cate_id' => array($auth, 'in'), ), ); } */ return $config;