status; $type = function() { return Dever::db('card/type')->state(); }; $cate = function() { $where['project_id'] = 1; return Dever::db('category/info')->getTop($where); }; $buy = array ( 1 => '可购买', 2 => '不可购买', ); $card_type = array ( 1 => '全数字', 2 => '全小写', 3 => '全大写', 4 => '大小写组合', 5 => '数字+大小写组合', ); $create_type = array ( 1 => '正常礼品卡', 2 => '合并礼品卡', 3 => '面值自定义卡', ); $shop_set = array ( 1 => '体验店无使用限制', ); $insert = false; $edit = false; $delete = false; # 权限设置 1是卡号列表、2是礼品卡使用统计 $search_auth = Dever::input('search_option_dever_auth', 1); $list_button = array(); if($search_auth == 1){ $insert = true; $edit = true; if(Dever::load('manage/auth')->checkFunc('card.info', 'sccard', '生成卡号')){ $list_button['fast'] = array('生成卡号', '"add&where_id=1&search_option_card_id={id}"', '{status} == 1'); } if(Dever::load('manage/auth')->checkFunc('card.info', 'cardlist', '卡号列表')){ $list_button['list1'] = array('卡号列表', '"code&search_option_card_id={id}&oper_table=info"'); } if(Dever::load('manage/auth')->checkFunc('card.info', 'kyshop', '可用商品设置')){ $list_button['location1'] = array('可用商品设置', Dever::url('lib/goods_set.home', 'card')); } } $button = array(); //$button['卡号列表'] = array('location', 'l=project/database/list&project=card&table=code&oper_table=info'); return array ( # 表名 'name' => 'info', # 显示给用户看的名称 'lang' => '面值配置', # 后台菜单排序 'order' => 99, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', //'list' => true, 'order' => 'desc', ), 'name' => array ( 'type' => 'varchar-80', 'name' => '礼品卡名称', 'default' => '', 'desc' => '请输入礼品卡名称', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, ), 'type_id' => array ( 'type' => 'int-11', 'name' => '礼品卡类型', 'default' => '1', 'desc' => '礼品卡类型', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $type, 'search' => $search_auth == 2 ? 'select' : '', 'list' => true, ), 'category' => array ( 'type' => 'varchar-500', 'name' => '可用商品分类-不选择则所有商品可用', 'default' => '', 'desc' => '可用商品分类', 'match' => 'option', //'search' => 'linkage', 'update' => 'checkbox', 'option' => $cate, //'option' => Dever::url('api.get', 'category'), //'list' => 'Dever::load("category/api.string", "{category}")', ), 'value' => array ( 'type' => 'int-11', 'name' => '面值', 'default' => '0', 'desc' => '面值', 'match' => 'is_numeric', 'update' => 'text', 'list_name' => $search_auth == 1 ? '面值/售价' : '礼品卡面值', 'list' => $search_auth == 1 ? '"{value}/{price}"' : true, ), 'price' => array ( 'type' => 'varchar-80', 'name' => '售价', 'default' => '0', 'desc' => '售价', 'match' => 'is_numeric', 'update' => 'text', //'list' => true, ), 'min' => array ( 'type' => 'varchar-80', 'name' => '最低消费-填写大于0的数值后,满足条件的商品总额需大于等于该数值,才能使用该礼品卡', 'default' => '0', 'desc' => '最低消费', 'match' => 'is_numeric', 'update' => 'text', //'list' => true, ), 'create_type' => array ( 'type' => 'int-11', 'name' => '生成类型-仅影响后台生成礼品卡时,生成的礼品卡类型,如代理商发放的礼品卡', 'default' => '1', 'desc' => '生成类型', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $create_type, 'search' => $search_auth == 2 ? 'select' : '', 'list' => true, ), 'buy' => array ( 'type' => 'int-11', 'name' => '是否可以购买', 'default' => '2', 'desc' => '是否可以购买', 'match' => 'is_numeric', 'update' => 'radio', 'option' => $buy, //'list' => true, ), 'shop_set' => array ( 'type' => 'varchar-80', 'name' => '特殊设置', 'default' => '', 'desc' => '特殊设置', 'match' => 'option', 'update' => 'checkbox', 'option' => $shop_set, ), 'card_type' => array ( 'type' => 'int-11', 'name' => '卡号生成规则', 'default' => '3', 'desc' => '卡号生成规则', 'match' => 'is_numeric', 'update' => 'select', 'option' => $card_type, 'list_name' => $search_auth == 1 ? '数量' : '兑换/发放数量', 'list' => $search_auth == 1 ? 'Dever::load("card/lib/manage.getNum", "{id}")' : 'Dever::load("card/lib/manage.getCardNum", "{id}")', ), 'card_prefix' => array ( 'type' => 'varchar-80', 'name' => '卡号前缀-前缀不占用卡号长度的位数,如卡号长度填写14,卡号前缀为Q,则生成卡号前缀+14位随机数', 'default' => '', 'desc' => '卡号前缀', 'match' => 'option', 'update' => 'text', ), 'card_len' => array ( 'type' => 'int-11', 'name' => '卡号长度', 'default' => '14', 'desc' => '卡号长度', 'match' => 'is_numeric', 'update' => 'text', ), 'end_dh_day' => array ( 'type' => 'int-11', 'name' => '兑换有效期-直接填写天数的数值', 'default' => '0', 'desc' => '兑换有效期', 'match' => 'is_numeric', 'update' => 'text', ), 'status' => array ( 'type' => 'int-11', 'name' => '状态', 'default' => '1', 'desc' => '状态', 'match' => 'is_numeric', //'update' => 'select', 'option' => $status, 'search' => $search_auth == 1 ? 'select' : '', 'list_name' => $search_auth == 1 ? '状态' :'已兑换面值', 'list' => $search_auth == 1 ? true : 'Dever::load("card/lib/manage.getDprice",{id})', 'edit' => true, ), 'content' => array ( 'type' => 'text-255', 'name' => '规则介绍', 'default' => '', 'desc' => '请输入内容', 'match' => 'is_string', 'update' => 'textarea', 'key' => '1', 'list_name' => $search_auth == 2 ? '已使用面值' :'', 'list' => $search_auth == 1 ? false : 'Dever::load("card/lib/manage.getDprice",{id},1)', ), 'reorder' => array ( 'type' => 'int-11', 'name' => '排序-数值越大越靠前', 'default' => '1', 'desc' => '请输入排序', 'match' => 'option', 'update' => 'text', 'search' => 'order', 'list_name' => $search_auth == 1 ? '排序' :'', 'list' => $search_auth == 1 ? true : false, 'order' => 'desc', 'edit' => true, ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', 'list_name' => $search_auth == 1 ? '' :'未兑换面值', 'list' => $search_auth == 1 ? false : 'Dever::load("card/lib/manage.getDprice",{id},2)', ), 'cdate' => array ( 'type' => 'int-11', 'name' => '录入时间', 'match' => array('is_numeric', time()), 'desc' => '', # 只有insert时才生效 'insert' => true, 'search' => $search_auth == 2 ? 'date' : false, 'list' => $search_auth == 1 ? 'date("Y-m-d H:i:s", {cdate})' : false, ), ), 'manage' => array ( 'insert' => $insert, 'edit' => $edit, 'delete' => $delete, 'list_button' => $list_button, 'button' => $button, ), 'request' => array ( 'getDataByType' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'buy' => 'yes', 'type_id' => array('yes', 'in'), 'create_type' => array('yes', 'in'), 'status' => 1, 'state' => 1, ), 'type' => 'all', 'order' => array('cdate' => 'desc'), 'col' => '*', ), ), );