'未领取', 2 => '已领取', 3 => '已使用', 4 => '已作废', ); $status = array ( 1 => '不可用', 2 => '可用', ); $product = function() { return Dever::load('journal/api.data'); }; $seller = function() { return Dever::db('code/seller')->state(); }; # 获取小刊分类权限 $auth = Dever::tops(); $cate = function() use ($auth) { $array = array(); if ($auth) { $info = Dever::db('journal/cate')->getIds(array('ids' => $auth)); } else { $info = Dever::db('journal/cate')->state(); } if($info) { $array += $info; } return $array; }; $name = 'info'; $create = Dever::config('database')->create; $data = Dever::input('search_linkage_product'); if (isset($data[1])) { $product_id = $data[1]; } else { $product_id = Dever::input('set_product_id'); } if ($product_id && $product_id > 0) { $name .= '_' . $product_id; $create = false; } return array ( # 表名 'name' => $name, # 显示给用户看的名称 'lang' => '兑换码列表', 'menu' => 'stat', 'order' => 1, 'create' => $create, 'auto' => 10000000, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', 'order' => 'desc', //'list' => true, ), 'create_uid' => array ( 'type' => 'int-11', 'name' => '创建人', 'default' => '-1', 'desc' => '创建人', 'match' => 'is_numeric', 'search' => array ( 'api' => 'passport/user-all', 'col' => 'username', 'result' => 'id', ), //'list' => 'Dever::load("code/lib/manage.showUserInfo", "{uid}", "{ldate}")', ), 'product' => array ( 'name' => '小刊', 'default' => '', 'desc' => '小刊', 'search' => 'linkage', 'search_col' => 'cate_id,product_id', 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'), ), 'cate_id' => array ( 'type' => 'int-11', 'name' => '小刊分类', 'default' => '1', 'desc' => '小刊分类', 'match' => 'is_numeric', 'update' => 'select', 'option' => $cate, //'search' => 'select', 'list' => true, ), 'product_id' => array ( 'type' => 'int-11', 'name' => '小刊', 'default' => '', 'desc' => '小刊', 'match' => 'is_numeric', 'update' => 'select', 'option' => $product, //'search' => 'select', 'list' => '{product_id} > 0 ? Dever::load("journal/info-one#name", {product_id}) : "通用"', ), 'code' => array ( 'type' => 'varchar-32', 'name' => '兑换码', 'default' => '', 'desc' => '兑换码', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => 'Dever::load("code/lib/manage.showCode", "{id}")', //'list' => true, ), 'score' => array ( 'type' => 'varchar-80', 'name' => '增加积分数-直接填写积分数,设置之后,积分规则里的设置及小刊兑换码中的设置将失效,当设置为0时,直接使用积分规则中的设置。当设置为-1时,不增加积分数', 'default' => '', 'desc' => '增加积分数', 'match' => 'is_string', //'update' => 'text', ), 'product_num' => array ( 'type' => 'int-11', 'name' => '兑换本数', 'default' => '0', 'desc' => '兑换本数', 'match' => 'option', 'update' => 'text', 'search' => 'fulltext', 'list' => true, ), 'type' => array ( 'type' => 'int-11', 'name' => '使用状态', 'default' => '1', 'desc' => '使用状态', 'match' => 'is_numeric', 'option' => $type, 'search' => 'select', 'update' => 'select', 'list' => true, 'mul' => array(1 => '恢复使用', 4 => '已作废'), ), 'seller_id' => array ( 'type' => 'int-11', 'name' => '销售商', 'default' => '1', 'desc' => '销售商', 'match' => 'is_numeric', 'update' => 'select', 'option' => $seller, 'search' => 'select', 'list' => true, ), 'uid' => array ( 'type' => 'int-11', 'name' => '用户信息', 'default' => '0', 'desc' => '用户信息', 'match' => 'is_numeric', 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}", "{type}")', ), 'order_id' => array ( 'type' => 'varchar-100', 'name' => '订单表ID', 'default' => '', 'desc' => '订单表ID', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, //'list' => '"{order_id}" ? "{order_id}" : "{code}"', ), 'state' => array ( 'type' => 'tinyint-1', 'name' => '状态', 'default' => '1', 'desc' => '请选择状态', 'match' => 'is_numeric', ), 'ldate' => array ( 'type' => 'int-11', 'name' => '领取时间', 'match' => 'option', 'default' => '', 'desc' => '', //'search' => 'date', ), '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})', ), ), //'top' => Dever::config('base')->top, # 增加这个,为了给当前的list增加一个option 'top_option' => array ( 'value' => $auth, 'col' => 'cate_id', ), # 更新表结构 'alter' => array ( 2 => array ( array('update', 'product_num', 'product_num', 'varchar-32 0 兑换本数'), //array('add', 'config', 'config', 'int-11 1 配置'), ), 'version' => 2, ), # 索引 'index' => array ( 4 => array ( 'order_id' => 'order_id', ), # 版本号 更改版本号会更新当前表的索引 'version' => 4, ), 'manage' => array ( 'excel' => true, 'delete' => false, 'edit' => false, 'insert' => false, 'mul' => '{type} == 1 || {type} == 4', # 自定义快捷新增和编辑 'button' => array ( '新增兑换码' => array('fast', 1, 'config&where_id=1'), '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'), '新增销售商' => array('fast', 1, 'seller'), ), 'list_button' => array ( 'oper' => array('作废', 'code/lib/manage.drop?id={id}&journal_id={product_id}&code={code}', '{type} == 1'), 'oper2' => array('恢复使用', 'code/lib/manage.recovery?id={id}&journal_id={product_id}&code={code}', '{type} == 4'), ), ), 'request' => array ( 'getAll' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'cate_id' => 'yes', 'create_uid' => 'yes', 'order_id' => 'yes', 'type' => array('yes', '!='), 'state' => 1, ), 'type' => 'all', 'order' => array('type' => 'asc', 'id' => 'desc'), 'page' => array(30, 'list'), 'col' => '*', ), 'getMyAll' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'order_id' => 'yes', 'create_uid' => 'yes', 'type' => array('yes', '!='), 'state' => 1, ), 'type' => 'all', 'order' => array('type' => 'asc', 'id' => 'desc'), 'page' => array(10, 'list'), 'col' => 'id,code,type,create_uid', ), 'getData' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'order_id' => 'yes', 'type' => array('yes', '!='), 'state' => 1, ), 'type' => 'all', 'order' => array('type' => 'asc', 'id' => 'desc'), 'col' => '*', ), ) );