266 lines
13 KiB
SQL
266 lines
13 KiB
SQL
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 ix_orderid ON vas_ch_cost (order_id);
|
|
CREATE INDEX mid_ct ON vas_ch_charge (mid, ct);
|
|
CREATE INDEX uid_ct ON vas_ch_charge (uid, ct);
|
|
CREATE INDEX ix_orderid ON vas_ch_charge (order_id);
|
|
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 INDEX ix_orderid ON vas_ch_withdraw (order_id);
|
|
|
|
|
|
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 ix_mid_product_id ON vas_user_membership_unlock (mid, product_id);
|
|
CREATE INDEX ix_orderid ON vas_user_membership_unlock (order_id);
|
|
|
|
-- 用户解锁空间详情
|
|
CREATE TABLE `vas_zone_unlock`
|
|
(
|
|
`id` bigint AUTO_INCREMENT COMMENT 'id',
|
|
`mid` bigint NOT NULL COMMENT '用户id',
|
|
`zid` bigint NOT NULL COMMENT '空间id',
|
|
`oid1` varchar(128) DEFAULT NULL COMMENT '辅助id1',
|
|
`oid2` varchar(128) DEFAULT NULL COMMENT '辅助id2',
|
|
`oid3` varchar(128) DEFAULT NULL COMMENT '辅助id3',
|
|
`oid4` varchar(128) DEFAULT NULL COMMENT '辅助id4',
|
|
`oid5` varchar(128) DEFAULT NULL COMMENT '辅助id5',
|
|
`consume` bigint DEFAULT 0 COMMENT '空间总消费',
|
|
`admission_ct` bigint DEFAULT 0 COMMENT '普通会员开通时间',
|
|
`admission_until` bigint DEFAULT 0 COMMENT '普通会员到期时间,时间戳,-1: 永久',
|
|
`admission_order_id` varchar(128) DEFAULT NULL COMMENT '普通会员订单id',
|
|
`admission_unlock_type` int DEFAULT 0 COMMENT '普通会员解锁类型',
|
|
`ironfanship_ct` bigint DEFAULT 0 COMMENT '铁粉开通时间',
|
|
`ironfanship_until` bigint DEFAULT 0 COMMENT '铁粉到期时间,时间戳,-1: 永久',
|
|
`ironfanship_order_id` varchar(128) DEFAULT NULL COMMENT '铁粉订单id',
|
|
`ironfanship_unlock_type` int DEFAULT 0 COMMENT '铁粉解锁类型',
|
|
`superfanship_ct` bigint DEFAULT 0 COMMENT '超粉开通时间',
|
|
`superfanship_until` bigint DEFAULT 0 COMMENT '超粉到期时间,时间戳,-1: 永久',
|
|
`superfanship_order_id` varchar(128) DEFAULT NULL COMMENT '超粉订单id',
|
|
`superfanship_unlock_type` int DEFAULT 0 COMMENT '超粉解锁类型',
|
|
PRIMARY KEY (`id`)
|
|
);
|
|
CREATE INDEX ix_mid_zid ON vas_zone_unlock (mid,zid);
|
|
CREATE INDEX ix_zid ON vas_zone_unlock (zid);
|
|
|
|
-- 空间消费详情
|
|
CREATE TABLE `vas_zone_ch`
|
|
(
|
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
`mid` bigint NOT NULL COMMENT '用户id',
|
|
`zid` bigint NOT NULL COMMENT '空间id',
|
|
`consume` bigint DEFAULT 0 COMMENT '单笔消费',
|
|
`ct` bigint DEFAULT 0 COMMENT '解锁时间',
|
|
`order_id` varchar(128) DEFAULT NULL COMMENT '绑定的订单id',
|
|
`product_id` varchar(128) DEFAULT NULL COMMENT '商品id',
|
|
PRIMARY KEY (`id`)
|
|
);
|
|
CREATE INDEX ix_mid_zid ON vas_zone_ch (mid,zid);
|
|
CREATE INDEX ix_zid ON vas_zone_ch (zid);
|
|
|
|
-- 空间成员列表
|
|
CREATE TABLE `vas_zone_member`
|
|
(
|
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
`mid` bigint NOT NULL COMMENT '用户id',
|
|
`zid` bigint NOT NULL COMMENT '空间id',
|
|
`member_type` int DEFAULT 0 COMMENT '空间成员类型',
|
|
`ct` bigint DEFAULT 0 COMMENT '解锁时间',
|
|
PRIMARY KEY (`id`)
|
|
);
|
|
CREATE INDEX ix_mid_zid_member_type ON vas_zone_member (mid,zid,member_type);
|
|
CREATE INDEX ix_zid_member_type ON vas_zone_member (zid,member_type);
|
|
|
|
-- 空间动态解锁
|
|
CREATE TABLE `vas_zone_moment_unlock`
|
|
(
|
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
|
|
`mid` bigint NOT NULL COMMENT '用户id',
|
|
`zid` bigint NOT NULL COMMENT '空间id',
|
|
`moment_id` bigint NOT NULL COMMENT '动态id',
|
|
`status` int NOT NULL COMMENT '状态',
|
|
`ct` bigint DEFAULT 0 COMMENT '解锁时间',
|
|
`order_id` varchar(128) DEFAULT NULL COMMENT '绑定的订单id',
|
|
PRIMARY KEY (`id`)
|
|
);
|
|
CREATE INDEX ix_mid_zid_moment_id ON vas_zone_moment_unlock (mid,zid,moment_id);
|
|
CREATE INDEX ix_mid_moment_id ON vas_zone_moment_unlock (mid,moment_id);
|
|
|
|
-- 空间退款记录
|
|
CREATE TABLE `vas_zone_refund_his`
|
|
(
|
|
`id` bigint AUTO_INCREMENT COMMENT 'id',
|
|
`mid` bigint NOT NULL COMMENT '用户id',
|
|
`zid` bigint NOT NULL COMMENT '空间id',
|
|
`ct` bigint DEFAULT 0 COMMENT '解锁时间',
|
|
`contact_name` varchar(128) DEFAULT NULL COMMENT '联系方式',
|
|
`contact_phone` varchar(128) DEFAULT NULL COMMENT '联系电话',
|
|
`note` varchar(1024) DEFAULT NULL COMMENT '备注',
|
|
`order_id` varchar(128) DEFAULT NULL COMMENT '绑定的订单id',
|
|
`product_id` varchar(128) DEFAULT NULL COMMENT '商品id',
|
|
PRIMARY KEY (`id`)
|
|
);
|
|
CREATE INDEX ix_mid_ct ON vas_zone_refund_his (mid,ct);
|
|
CREATE INDEX ix_zid_ct ON vas_zone_refund_his (zid,ct);
|
|
CREATE INDEX ix_orderid_ct ON vas_zone_refund_his (order_id,ct);
|
|
CREATE INDEX ix_ct ON vas_zone_refund_his (ct);
|