/*
SQLyog Community v13.1.6 (64 bit)
MySQL - 5.7.21-log : Database - test_cps_shard_192
*********************************************************************
*/

/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`test_cps_shard_192` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `test_cps_shard_192`;

/*Table structure for table `consume` */

DROP TABLE IF EXISTS `consume`;

CREATE TABLE `consume` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `type` enum('1','2','3','4','5','6') COLLATE utf8mb4_unicode_ci DEFAULT '1' COMMENT '消费类型:1=订购章节,2=打赏,3=读书挑战赛',
  `book_id` bigint(20) unsigned DEFAULT NULL COMMENT '书籍ID',
  `book_name` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '书籍名称',
  `chapter_id` bigint(20) unsigned DEFAULT NULL COMMENT '章节ID',
  `chapter_name` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '章节名称',
  `kandian` int(11) unsigned DEFAULT '0' COMMENT '充值看点数',
  `free_kandian` int(11) unsigned DEFAULT '0' COMMENT '赠送看点数',
  `extend1` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '扩展01',
  `extend2` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '扩展02',
  `createtime` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  `business_line` tinyint(4) NOT NULL DEFAULT '0' COMMENT '消费来源的业务线。0、公众号；1、安卓app。',
  `dd_kandian` int(10) unsigned DEFAULT '0' COMMENT '消耗的扣量永久书币数量',
  `dd_free_kandian` int(10) unsigned DEFAULT '0' COMMENT '消耗的扣量免费书币数量',
  `camp_info` json DEFAULT NULL COMMENT '读书挑战赛活动',
  `consume_info` json DEFAULT NULL COMMENT '对应各充值记录消费情况',
  PRIMARY KEY (`id`),
  KEY `consume_book_id` (`book_id`),
  KEY `consume_chapter_id` (`chapter_id`),
  KEY `consume_createtime` (`createtime`),
  KEY `consume_type` (`type`),
  KEY `consume_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='消费表';

/*Data for the table `consume` */

/*Table structure for table `recharge` */

DROP TABLE IF EXISTS `recharge`;

CREATE TABLE `recharge` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `type` enum('1','2','3','4','5') COLLATE utf8mb4_unicode_ci DEFAULT '1' COMMENT '充值类型:1=看点充值,2=VIP充值,3=系统操作看点,4=系统操作vip,5=签到',
  `kandian` int(11) DEFAULT '0' COMMENT '充值看点数',
  `free_kandian` int(11) DEFAULT '0' COMMENT '赠送看点数',
  `remain_free_kandian` int(10) unsigned DEFAULT '0' COMMENT '剩余免费看点',
  `free_endtime` int(10) unsigned DEFAULT NULL COMMENT '赠送看点到期时间',
  `day` int(11) DEFAULT '0' COMMENT 'VIP天数',
  `hour` tinyint(2) DEFAULT NULL COMMENT 'vip小时',
  `book_id` bigint(20) unsigned DEFAULT NULL COMMENT '书籍ID',
  `createtime` int(10) unsigned DEFAULT NULL COMMENT '创建时间',
  `updatetime` int(10) unsigned DEFAULT NULL COMMENT '更新时间',
  `notes` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
  `edit_type` enum('1','2') COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '充值类型:1=活动奖励,2=系统操作',
  PRIMARY KEY (`id`),
  KEY `re_free_endtime` (`free_endtime`) COMMENT 'recharge__free_endtime索引',
  KEY `recharge_user_id` (`user_id`) COMMENT 'recharge__user_id索引'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='充值表';

/*Data for the table `recharge` */

/*Table structure for table `sign` */

DROP TABLE IF EXISTS `sign`;

CREATE TABLE `sign` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `uid` int(11) NOT NULL DEFAULT '0',
  `kandian` int(5) NOT NULL DEFAULT '0' COMMENT '签到赠送看点',
  `days` tinyint(4) DEFAULT '1' COMMENT '连续签到天数',
  `createdate` int(8) NOT NULL DEFAULT '0',
  `createtime` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `sign1_createdate` (`createdate`),
  KEY `sign1_uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='签到表';

/*Data for the table `sign` */

/*Table structure for table `user_recently_read` */

DROP TABLE IF EXISTS `user_recently_read`;

CREATE TABLE `user_recently_read` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `book_id` bigint(20) unsigned NOT NULL COMMENT '书籍ID',
  `chapter_id` bigint(20) unsigned NOT NULL COMMENT '章节ID',
  `chapter_name` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '章节名称',
  `flag` tinyint(4) DEFAULT '1' COMMENT '是否生效。1、生效；0、已删除。',
  `createtime` int(10) unsigned NOT NULL COMMENT '创建时间',
  `updatetime` int(10) unsigned NOT NULL COMMENT '更新时间',
  `book_shelf_add` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '书籍加入书架。1加入书架；0没有加入书架。',
  `book_shelf_flag` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '加入书架状态。1、生效；0、已删除。',
  PRIMARY KEY (`id`),
  KEY `sign_book_id` (`book_id`),
  KEY `sign_updatetime` (`updatetime`),
  KEY `sign_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='最近阅读表';

/*Data for the table `user_recently_read` */

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
