'可用', 2 => '禁用', ); $cate = function() { $array = array(); $info = Dever::db('quan/cate')->state(); if($info) { $array += $info; } return $array; }; $score = function() { $array = array(); $info = Dever::load('score/lib/core')->getScore(); if($info) { $array += $info; } return $array; }; $function = array ( 1 => '购买', 2 => '使用', 3 => '持有', //4 => '邀请', /* 5 => '等级', 6 => '提现', 11 => '赠送券', */ ); $buy_condition = array ( 1 => '直接购买', 2 => '需要上级购买', ); $buy_repeat = array ( 1 => '不可以重复购买', 2 => '允许重复购买', ); return array ( # 表名 'name' => 'info', # 显示给用户看的名称 'lang' => '券管理', 'order' => 100, # 数据结构 '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-80', 'name' => '券名称', 'default' => '', 'desc' => '券名称', 'match' => 'is_string', 'update' => 'text', 'list' => true, 'search' => 'fulltext', ), 'cate_id' => array ( 'type' => 'int-11', 'name' => '所属分类', 'default' => '1', 'desc' => '所属分类', 'match' => 'is_numeric', 'update' => 'select', 'option' => $cate, 'search' => 'select', 'list' => 'Dever::load("quan/cate-one#name", {cate_id})', ), 'desc' => array ( 'type' => 'varchar-500', 'name' => '券描述-券的描述文字', 'default' => '', 'desc' => '券描述', 'match' => 'option', 'update' => 'textarea', ), 'value' => array ( 'type' => 'varchar-80', 'name' => '券面值-面值描述文字', 'default' => '', 'desc' => '券面值', 'match' => 'is_string', 'update' => 'text', 'list' => true, ), 'icon' => array ( 'type' => 'varchar-150', 'name' => '1:1图标-图片尺寸150*150px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式', 'default' => '', 'desc' => '图标', 'match' => 'option', 'update' => 'image', 'key' => '1', 'place' => '150', //直接上传到云端 //'upload' => 'qiniu', //上传大数据 //'large' => true, ), 'hr2' => array ( 'name' => '功能设置', 'class' => '',//本项必须填写 'attr' => '', ), 'function' => array ( 'type' => 'varchar-30', 'name' => '功能选择', 'default' => '1,2', 'desc' => '功能选择', 'match' => 'is_string', 'update' => 'checkbox', 'option' => $function, 'control' => 'function', ), 'buy_condition' => array ( 'type' => 'tinyint-1', 'name' => '[购买]条件', 'default' => '1', 'desc' => '购买条件', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $buy_condition, 'show' => 'function=1', ), 'buy_repeat' => array ( 'type' => 'tinyint-1', 'name' => '重复[购买]', 'default' => '1', 'desc' => '重复购买', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $buy_repeat, 'show' => 'function=1', ), 'buy_set' => array ( 'type' => 'text-1000', 'name' => '[购买]积分设置', 'default' => '', 'desc' => '购买积分设置', 'match' => 'is_string', 'show' => 'function=1', 'update' => array ( array ( 'col' => 'score_id', 'name' => '选择积分', 'default' => '1', 'desc' => '选择积分', 'match' => 'is_numeric', 'update' => 'select', 'option' => $score, ), array ( 'col' => 'score_num', 'name' => '所需积分的数量', 'default' => '0', 'desc' => '所需积分的数量', 'match' => 'option', 'update' => 'text', ), ), ), 'use_qtime' => array ( 'type' => 'int-11', 'name' => '[使用]有效期-直接填写天数即可,如有效期为10天,直接填写10', 'default' => '', 'desc' => '有效期', 'match' => 'option', 'update' => 'text', 'show' => 'function=2', ), 'use_qdate' => array ( 'type' => 'int-11', 'name' => '[使用]截止时间-选择当前券的截止时间,如果有效期和截止时间都填写了,以截止时间为准', 'default' => '', 'desc' => '截止时间', 'match' => 'option', 'update' => 'date', 'callback' => 'maketime', 'show' => 'function=2', ), 'use_max' => array ( 'type' => 'text-1000', 'name' => '[使用]满减积分', 'default' => '', 'desc' => '满减积分设置', 'match' => 'is_string', 'show' => 'function=2', 'update' => array ( array ( 'col' => 'score_id', 'name' => '选择积分', 'default' => '1', 'desc' => '选择积分', 'match' => 'is_numeric', 'update' => 'select', 'option' => $score, ), array ( 'col' => 'score_total', 'name' => '满减积分的总额-如满100减20,则填写100即可', 'default' => '0', 'desc' => '满减积分的总额', 'match' => 'option', 'update' => 'text', ), array ( 'col' => 'score_num', 'name' => '满减积分的数量-如满100减20,则填写20即可', 'default' => '0', 'desc' => '满减积分的数量', 'match' => 'option', 'update' => 'text', ), ), ), 'use_give' => array ( 'type' => 'text-1000', 'name' => '[使用]赠送积分', 'default' => '', 'desc' => '赠送积分设置', 'match' => 'is_string', 'show' => 'function=2', 'update' => array ( array ( 'col' => 'score_id', 'name' => '选择积分', 'default' => '1', 'desc' => '选择积分', 'match' => 'is_numeric', 'update' => 'select', 'option' => $score, ), array ( 'col' => 'score_num', 'name' => '赠送积分的数量', 'default' => '0', 'desc' => '赠送积分的数量', 'match' => 'option', 'update' => 'text', ), ), ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序(数值越大越靠前)', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', //'update' => 'text', 'search' => 'order', 'list' => true, 'order' => 'desc', 'edit' => true, ), 'content' => array ( 'type' => 'text-255', 'name' => '内容介绍', 'default' => '', 'desc' => '请输入内容', 'match' => 'is_string', 'update' => 'editor', 'key' => '1', ), 'status' => array ( 'type' => 'int-11', 'name' => '发布状态', 'default' => '2', 'desc' => '发布状态', 'match' => 'is_numeric', //'update' => 'select', 'option' => $status, 'search' => 'select', 'list' => true, 'edit' => true, ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', ), 'admin' => array ( 'type' => 'int-11', 'name' => '操作人', 'default' => '1', 'desc' => '操作人', 'match' => 'is_numeric', ), 'udate' => array ( 'type' => 'int-11', 'name' => '更新时间', 'match' => array('is_numeric', time()), 'desc' => '', ), 'cdate' => array ( 'type' => 'int-11', 'name' => '录入时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, ), ), # 索引 'index' => array ( 'version' => 1, 1 => array ( 'i1' => 'cate_id,reorder', ) ), # 管理功能 'manage' => array ( ), # 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'), 'limit' => '0,1000', 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id', ), ), );