CREATE TABLE `vas_order` ( `id` varchar(128) NOT NULL COMMENT '订单id', `mid` bigint DEFAULT NULL COMMENT '用户id', `uid` bigint DEFAULT NULL COMMENT '关联用户id', `oid1` varchar(128) DEFAULT NULL COMMENT '辅助id1', `oid2` varchar(128) DEFAULT NULL COMMENT '辅助id2', `oid3` varchar(128) DEFAULT NULL COMMENT '辅助id3', `product_id` varchar(128) DEFAULT NULL COMMENT '商品id', `pay_type` char(32) DEFAULT NULL COMMENT '支付类型 alipay, wxpay, applepay', `pay_amount` bigint DEFAULT NULL COMMENT '支付金额', `out_order_id` varchar(128) DEFAULT NULL COMMENT '分别对应于支付宝、微信、苹果方的订单ID', `receipt_data` mediumtext COMMENT 'ios收据', `coins` bigint DEFAULT NULL COMMENT '金币', `order_status` tinyint DEFAULT NULL COMMENT '订单状态', `order_from` varchar(64) DEFAULT NULL COMMENT '订单创建来源', `ct` int DEFAULT NULL COMMENT '创建时间', `ut` int DEFAULT NULL COMMENT '更新时间', `operator` char(64) DEFAULT NULL COMMENT '操作人', `ext` varchar(1024) DEFAULT NULL COMMENT '额外业务信息', `b_did` char(64) DEFAULT NULL COMMENT '设备id', `b_ver` char(32) DEFAULT NULL COMMENT '版本', `b_osver` char(32) DEFAULT NULL COMMENT '系统版本', `b_dt` tinyint DEFAULT NULL COMMENT '设备类型', `b_ch` char(32) DEFAULT NULL COMMENT '渠道', `b_model` char(32) DEFAULT NULL COMMENT '机型', `b_nt` char(32) DEFAULT NULL COMMENT '网络渠道', `ip` char(32) DEFAULT NULL COMMENT '下单时候的ip', PRIMARY KEY (`id`) ); CREATE INDEX out_order_id ON vas_order (out_order_id); CREATE INDEX ct_status ON vas_order (ct, order_status); CREATE INDEX ix_ct_productid ON vas_order (ct, product_id); CREATE TABLE `vas_wallet` ( `id` bigint NOT NULL COMMENT '用户id', `coins` bigint DEFAULT NULL COMMENT '金币', `diamonds` bigint DEFAULT NULL COMMENT '钻石', `withdraw_diamonds` bigint DEFAULT NULL COMMENT '提现钻石', PRIMARY KEY (`id`) ); -- vas_ch_cost、vas_ch_charge、vas_ch_income、vas_ch_withdraw CREATE TABLE `vas_ch_income` ( `id` bigint AUTO_INCREMENT COMMENT 'id', `mid` bigint NOT NULL COMMENT '用户id', `uid` bigint DEFAULT NULL COMMENT '关联用户id', `did` char(64) DEFAULT NULL COMMENT '用户did', `type` int NOT NULL COMMENT '消费类型', `stype` int NOT NULL COMMENT '消费子类型', `type_id` varchar(128) DEFAULT NULL COMMENT '对应的物品id', `order_id` varchar(128) DEFAULT NULL COMMENT '订单id', `change` bigint DEFAULT NULL COMMENT '变化,可正可负', `before` bigint DEFAULT NULL COMMENT '变化前', `after` bigint DEFAULT NULL COMMENT '变化后', `count` bigint DEFAULT NULL COMMENT '数量', `ct` bigint DEFAULT NULL COMMENT '时间', PRIMARY KEY (`id`) ); CREATE INDEX mid_ct ON vas_ch_cost (mid, ct); CREATE INDEX uid_ct ON vas_ch_cost (uid, ct); CREATE INDEX mid_ct ON vas_ch_charge (mid, ct); CREATE INDEX uid_ct ON vas_ch_charge (uid, ct); CREATE INDEX mid_ct ON vas_ch_income (mid, ct); CREATE INDEX uid_ct ON vas_ch_income (uid, ct); CREATE INDEX ix_orderid ON vas_ch_income (order_id); CREATE INDEX mid_ct ON vas_ch_withdraw (mid, ct); CREATE INDEX uid_ct ON vas_ch_withdraw (uid, ct); CREATE TABLE `vas_coin_order` ( `id` varchar(128) NOT NULL COMMENT '订单id', `mid` bigint DEFAULT NULL COMMENT '用户id', `uid` bigint DEFAULT NULL COMMENT '关联用户id', `oid1` varchar(128) DEFAULT NULL COMMENT '辅助id1', `oid2` varchar(128) DEFAULT NULL COMMENT '辅助id2', `oid3` varchar(128) DEFAULT NULL COMMENT '辅助id3', `product_id` varchar(128) DEFAULT NULL COMMENT '商品id', `coins` bigint DEFAULT NULL COMMENT '金币', `order_status` tinyint DEFAULT NULL COMMENT '订单状态', `order_from` varchar(64) DEFAULT NULL COMMENT '订单创建来源', `qq` varchar(128) DEFAULT NULL COMMENT 'qq', `wechat` varchar(128) DEFAULT NULL COMMENT '微信', `phone` varchar(128) DEFAULT NULL COMMENT '电话号', `addr` varchar(128) DEFAULT NULL COMMENT '地址', `note` varchar(128) DEFAULT NULL COMMENT '备注', `op_note` varchar(128) DEFAULT NULL COMMENT 'op备注', `ct` int DEFAULT NULL COMMENT '创建时间', `ut` int DEFAULT NULL COMMENT '更新时间', `ext` varchar(1024) DEFAULT NULL COMMENT '额外业务信息', `b_did` char(64) DEFAULT NULL COMMENT '设备id', `b_ver` char(32) DEFAULT NULL COMMENT '版本', `b_osver` char(32) DEFAULT NULL COMMENT '系统版本', `b_dt` tinyint DEFAULT NULL COMMENT '设备类型', `b_ch` char(32) DEFAULT NULL COMMENT '渠道', `b_model` char(32) DEFAULT NULL COMMENT '机型', `b_nt` char(32) DEFAULT NULL COMMENT '网络渠道', `ip` char(32) DEFAULT NULL COMMENT '下单时候的ip', PRIMARY KEY (`id`) ); CREATE INDEX uid_product_id_status ON vas_coin_order (uid, product_id, order_status); CREATE INDEX ix_ct ON vas_coin_order (ct); CREATE TABLE `vas_user_unlock` ( `id` bigint AUTO_INCREMENT COMMENT 'id', `mid` bigint NOT NULL COMMENT '用户id', `uid` bigint NOT NULL COMMENT '关联用户id', `product_id` varchar(128) NOT NULL COMMENT '商品id', `ct` bigint DEFAULT NULL COMMENT '时间', `lock_type` int NOT NULL COMMENT '网红当时的私密类型', `status` int NOT NULL COMMENT '状态', `means` varchar(128) DEFAULT NULL COMMENT '解锁方式', `order_id` varchar(128) DEFAULT NULL COMMENT '订单id', PRIMARY KEY (`id`) ); CREATE INDEX mid_uid_product_id ON vas_user_unlock (mid, uid, product_id); CREATE TABLE `vas_withdraw_order` ( `id` varchar(128) NOT NULL COMMENT '订单id', `mid` bigint DEFAULT NULL COMMENT '用户id', `did` char(64) DEFAULT NULL COMMENT '设备id', `apply_time` int DEFAULT NULL COMMENT '申请时间', `alipay_id` varchar(128) DEFAULT NULL COMMENT '支付宝账号', `alipay_name` varchar(128) DEFAULT NULL COMMENT '支付宝姓名', `withdraw_dias` bigint DEFAULT NULL COMMENT '提现钻石数', `withdraw_money` bigint DEFAULT NULL COMMENT '提现金额', `ip` char(32) DEFAULT NULL COMMENT '下单时候的ip', `order_status` tinyint DEFAULT NULL COMMENT '订单状态', `operator` varchar(128) DEFAULT NULL COMMENT '操作的运营同学', `op_time` int DEFAULT NULL COMMENT 'op操作时间', PRIMARY KEY (`id`) ); CREATE INDEX ix_mid_applytime ON vas_withdraw_order (mid, apply_time); CREATE TABLE `vas_withdraw_diamonds_his` ( `id` bigint AUTO_INCREMENT COMMENT 'id', `mid` bigint NOT NULL COMMENT '用户id', `income_ch_id` bigint NOT NULL COMMENT '收入明细中的id', `order_id` varchar(128) NOT NULL COMMENT '金币订单id', `ct` bigint DEFAULT NULL COMMENT '时间', `before_withdraw_diamonds` bigint DEFAULT NULL COMMENT 'before', `after_withdraw_diamonds` bigint DEFAULT NULL COMMENT 'after', `change` bigint DEFAULT NULL COMMENT '增加的可提现钻石数', PRIMARY KEY (`id`) ); CREATE INDEX ix_mid ON vas_withdraw_diamonds_his (mid); CREATE INDEX ix_ct ON vas_withdraw_diamonds_his (ct); CREATE INDEX ix_order_id ON vas_withdraw_diamonds_his (order_id); CREATE INDEX ix_chid ON vas_withdraw_diamonds_his (income_ch_id); CREATE TABLE `vas_user_membership_unlock` ( `id` bigint AUTO_INCREMENT COMMENT 'id', `mid` bigint NOT NULL COMMENT '用户id', `product_id` varchar(128) NOT NULL COMMENT '商品id', `ct` bigint DEFAULT NULL COMMENT '时间', `means` varchar(128) DEFAULT NULL COMMENT '解锁方式', `order_id` varchar(128) DEFAULT NULL COMMENT '订单id', PRIMARY KEY (`id`) ); CREATE INDEX uni_idx_mid_product_id ON vas_user_unlock (mid, product_id);