原型:查询数据库中不同类型的激活码领取比率
建表:
DROP TABLE IF EXISTS `game_gift`;
CREATE TABLE `game_gift` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`code` varchar(64) NOT NULL,
`receive_time` datetime DEFAULT NULL,
`status` int(1) NOT NULL DEFAULT '0' COMMENT '是否领取(0:否,1:是)',
`type` int(1) NOT NULL DEFAULT '1' COMMENT '激活码类型',
`account_id` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1601 DEFAULT CHARSET=utf8;
插入数据:
INSERT INTO `game_gift` VALUES ('11', 'XXXXXXXXXXXXXXXXX', null, '1', '1', null);
INSERT INTO `game_gift` VALUES ('12', 'XXXXXXXXXXXXXXXXX', null, '1', '1', null);
INSERT INTO `game_gift` VALUES ('13', 'XXXXXXXXXXXXXXXXX', null, '1', '1', null);
INSERT INTO `game_gift` VALUES ('14', 'XXXXXXXXXXXXXXXXX', null, '1', '1', null);
INSERT INTO `game_gift` VALUES ('15', 'XXXXXXXXXXXXXXXXX', null, '0', '1', null);
INSERT INTO `game_gift` VALUES ('16', 'XXXXXXXXXXXXXXXXX', null, '0', '1', null);
INSERT INTO `game_gift` VALUES ('17', 'XXXXXXXXXXXXXXXXX', null, '0', '1', null);
INSERT INTO `gam