'已生成', 2 => '已绑定', 3 => '已兑换', 4 => '已使用', 5 => '已过期', ); $type = array ( 1 => '商城用户', 2 => '代理商', ); return array ( # 表名 'name' => 'code', # 显示给用户看的名称 'lang' => '礼品卡卡号', 'status' => $status, 'check' => 'card', # 后台菜单排序 'order' => 99, 'menu' => false, # 数据结构 'struct' => array ( 'id' => array ( 'type' => 'int-11', 'name' => 'ID', 'default' => '', 'desc' => '', 'match' => 'is_numeric', 'search' => 'order', 'list' => true, 'order' => 'desc', ), 'card_id' => array ( 'type' => 'int-11', 'name' => '礼品卡', 'default' => '', 'desc' => '礼品卡', 'match' => 'is_numeric', 'update' => 'hidden', 'search' => 'hidden', 'value' => Dever::input('search_option_card_id'), 'list' => 'Dever::load("card/info-find#name", "{card_id}")', ), 'card' => array ( 'type' => 'varchar-32', 'name' => '卡号', 'default' => '', 'desc' => '卡号', 'match' => 'is_string', 'update' => 'text', 'search' => 'fulltext', 'list' => true, ), 'status' => array ( 'type' => 'int-11', 'name' => '使用状态', 'default' => '1', 'desc' => '使用状态', 'match' => 'is_numeric', 'option' => $status, 'search' => 'select', 'update' => 'select', 'list' => true, //'mul' => array(1 => '恢复使用', 4 => '已作废'), ), 'total_cash' => array ( 'type' => 'float-11,2', 'name' => '总额', 'default' => '0', 'desc' => '总额', 'match' => 'option', 'update' => 'text', ), 'use_cash' => array ( 'type' => 'float-11,2', 'name' => '已使用', 'default' => '0', 'desc' => '已使用', 'match' => 'option', 'update' => 'text', ), 'type' => array ( 'type' => 'tinyint-1', 'name' => '类型', 'default' => '1', 'desc' => '类型', 'match' => 'is_numeric', 'option' => $type, ), 'uid' => array ( 'type' => 'int-11', 'name' => '下单用户', 'default' => '0', 'desc' => '下单用户', 'match' => 'is_numeric', 'list_name' => '更多信息', 'list' => 'Dever::load("card/lib/manage.showUserInfo", "{id}")', ), 'dh_uid' => array ( 'type' => 'int-11', 'name' => '兑换用户', 'default' => '0', 'desc' => '兑换用户', 'match' => 'is_numeric', ), 'shop_id' => array ( 'type' => 'int-11', 'name' => '门店', 'default' => '', 'desc' => '门店', 'match' => 'is_numeric', ), 'city' => array ( 'type' => 'int-11', 'name' => '城市', 'default' => '', 'desc' => '城市', 'match' => 'option', //'update' => 'text', ), 'order_id' => array ( 'type' => 'int-11', 'name' => '订单表id', 'default' => '', 'desc' => '订单表id', 'match' => 'is_numeric', ), 'order_card_id' => array ( 'type' => 'int-11', 'name' => '订单表id', 'default' => '', 'desc' => '订单表id', 'match' => 'is_numeric', ), 'bdate' => array ( 'type' => 'int-11', 'name' => '绑定时间', 'match' => 'option', 'default' => '', 'desc' => '', //'search' => 'date', ), 'ddate' => array ( 'type' => 'int-11', 'name' => '兑换时间', 'match' => 'option', 'default' => '', 'desc' => '', // 'search' => 'date', ), '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, 'list' => 'date("Y-m-d H:i:s", {cdate})', ), ), 'alter' => array ( 2 => array ( array('update', 'total_cash', 'total_cash', 'float-11 0 总面值'), array('update', 'use_cash', 'use_cash', 'float-11 0 已用面值'), ), 'version' => 2, ), 'manage' => array ( 'excel' => array(array('导出数据', '礼品卡卡号列表', 'card/lib/manage.outCode')), 'delete' => false, 'edit' => false, 'insert' => false, // 'mul' => '{type} == 1 || {type} == 4', 'list_button' => array ( //'oper' => array('作废', 'goods/lib/manage.drop?id={id}', '{type} == 1'), //'oper2' => array('恢复使用', 'goods/lib/manage.recovery?id={id}', '{type} == 4'), ), ), # 索引 'index' => array ( # 索引名 => 索引id 1 => array ( 'card' => 'card', 'uid' => 'uid', 'dh_uid' => 'dh_uid', ), 'version' => 1, ), 'request' => array ( 'getData' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'uid' => 'yes', 'dh_uid' => 'yes', 'card_id' => 'yes', 'status' => 'yes', 'state' => 1, ), 'type' => 'all', //'limit' => '0,1000', 'order' => array('ddate' => 'desc'), 'col' => '*', ), 'getPageData' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'uid' => 'yes', 'dh_uid' => 'yes', 'status' => 'yes', 'state' => 1, ), 'type' => 'all', 'page' => array(100, 'list'), 'order' => array('total_cash`-`use_cash' => 'desc', 'ddate' => 'desc'), 'col' => '*', ), 'incUseCash' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'use_cash' => array('yes', '+='), ), ), 'decUseCash' => array ( 'type' => 'update', 'where' => array ( 'id' => 'yes', ), 'set' => array ( 'use_cash' => array('yes', '-='), ), ), #兑换的数量 'getNum' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'card_id' => 'yes', 'status' => 'yes', 'state' => 1, ), 'type' => 'count', 'col' => '*', ), 'getDuiprice' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'card_id' => 'yes', 'status' => array('yes','in'), 'state' => 1, ), 'type' => 'one', 'col' => 'sum(total_cash) as total', ), #已使用的面值 'getDprice' => array ( # 匹配的正则或函数 选填项 'option' => array ( 'card_id' => 'yes', // 'status' => 'yes', 'state' => 1, ), 'type' => 'one', 'col' => 'sum(use_cash) as total', ), ), );