service/dbstruct/vas.sql

266 lines
13 KiB
MySQL
Raw Normal View History

2023-12-21 22:17:40 +08:00
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`)
);
2024-01-01 12:19:42 +08:00
CREATE INDEX out_order_id ON vas_order (out_order_id);
2024-01-04 18:10:19 +08:00
CREATE INDEX ct_status ON vas_order (ct, order_status);
2024-02-03 17:23:08 +08:00
CREATE INDEX ix_ct_productid ON vas_order (ct, product_id);
2023-12-21 22:17:40 +08:00
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
2023-12-23 17:09:07 +08:00
CREATE TABLE `vas_ch_income`
2023-12-21 22:17:40 +08:00
(
`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`)
);
2024-01-01 12:19:42 +08:00
CREATE INDEX mid_ct ON vas_ch_cost (mid, ct);
CREATE INDEX uid_ct ON vas_ch_cost (uid, ct);
2024-03-19 10:20:50 +08:00
CREATE INDEX ix_orderid ON vas_ch_cost (order_id);
2024-01-01 12:19:42 +08:00
CREATE INDEX mid_ct ON vas_ch_charge (mid, ct);
CREATE INDEX uid_ct ON vas_ch_charge (uid, ct);
2024-03-19 10:20:50 +08:00
CREATE INDEX ix_orderid ON vas_ch_charge (order_id);
2024-01-01 12:19:42 +08:00
CREATE INDEX mid_ct ON vas_ch_income (mid, ct);
CREATE INDEX uid_ct ON vas_ch_income (uid, ct);
2024-01-08 22:38:18 +08:00
CREATE INDEX ix_orderid ON vas_ch_income (order_id);
2024-01-01 12:19:42 +08:00
CREATE INDEX mid_ct ON vas_ch_withdraw (mid, ct);
CREATE INDEX uid_ct ON vas_ch_withdraw (uid, ct);
2024-03-19 10:20:50 +08:00
CREATE INDEX ix_orderid ON vas_ch_withdraw (order_id);
2023-12-21 22:17:40 +08:00
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`)
);
2024-01-01 12:19:42 +08:00
CREATE INDEX uid_product_id_status ON vas_coin_order (uid, product_id, order_status);
2024-01-08 22:38:18 +08:00
CREATE INDEX ix_ct ON vas_coin_order (ct);
2024-01-01 12:19:42 +08:00
2023-12-21 22:17:40 +08:00
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`)
2024-01-01 12:19:42 +08:00
);
2024-01-01 12:23:40 +08:00
CREATE INDEX mid_uid_product_id ON vas_user_unlock (mid, uid, product_id);
2024-01-08 12:40:27 +08:00
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`)
);
2024-01-08 22:38:18 +08:00
CREATE INDEX ix_mid_applytime ON vas_withdraw_order (mid, apply_time);
2024-01-21 12:27:34 +08:00
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);
2024-03-13 20:35:18 +08:00
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`)
);
2024-03-13 20:35:18 +08:00
CREATE INDEX ix_mid_product_id ON vas_user_membership_unlock (mid, product_id);
2024-04-16 10:49:02 +08:00
CREATE INDEX ix_orderid ON vas_user_membership_unlock (order_id);
-- 用户解锁空间详情
CREATE TABLE `vas_zone_unlock`
(
2024-04-16 20:20:53 +08:00
`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 '超粉解锁类型',
2024-04-16 10:49:02 +08:00
PRIMARY KEY (`id`)
);
2024-04-25 16:10:56 +08:00
CREATE INDEX ix_mid_zid ON vas_zone_unlock (mid,zid);
CREATE INDEX ix_zid ON vas_zone_unlock (zid);
2024-04-16 10:49:02 +08:00
-- 空间消费详情
CREATE TABLE `vas_zone_ch`
(
2024-04-25 16:10:56 +08:00
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
2024-04-16 10:49:02 +08:00
`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`)
);
2024-04-25 16:10:56 +08:00
CREATE INDEX ix_mid_zid ON vas_zone_ch (mid,zid);
CREATE INDEX ix_zid ON vas_zone_ch (zid);
2024-04-16 10:49:02 +08:00
-- 空间成员列表
CREATE TABLE `vas_zone_member`
(
2024-04-25 16:10:56 +08:00
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
2024-04-16 21:13:26 +08:00
`mid` bigint NOT NULL COMMENT '用户id',
`zid` bigint NOT NULL COMMENT '空间id',
`member_type` int DEFAULT 0 COMMENT '空间成员类型',
`ct` bigint DEFAULT 0 COMMENT '解锁时间',
2024-04-16 10:49:02 +08:00
PRIMARY KEY (`id`)
);
2024-04-25 16:10:56 +08:00
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);
2024-04-16 10:49:02 +08:00
-- 空间动态解锁
CREATE TABLE `vas_zone_moment_unlock`
(
2024-04-25 16:10:56 +08:00
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
2024-04-16 10:49:02 +08:00
`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`)
);
2024-04-25 16:10:56 +08:00
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);
2024-04-16 10:49:02 +08:00
-- 空间退款记录
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`)
);
2024-04-29 17:52:52 +08:00
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);