记得上下班打卡 | git大法好,push需谨慎

Commit fc498929 authored by 张国柄's avatar 张国柄

+sql;

parent f43357f0
......@@ -41,6 +41,96 @@ CREATE TABLE `kylin_order_coupons`
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT '订单券 关联表';
-- >>------------------------------------------------------------------------------------ |20210817会员与券改版
# 添加`双倍积分`开关
alter table adam_member add integral_rate decimal(8, 2) default 0 null comment '积分倍率X100' after state;
# 添加`是否开售`开关,新增开售开关字段
alter table adam_member add onsale tinyint default 0 null comment '是否开售:1-开售|2-停售' after integral_rate;
# 添加限购逻辑,新增限购开始、结束时间字段
alter table adam_member add limitb_at datetime(3) null comment '限购开始时间' after limitation;
alter table adam_member add limite_at datetime(3) null comment '限购结束时间' after limitb_at;
# 添加会员价格字段
alter table adam_member_price modify price_fixed decimal(8, 2) null comment '购买价格';
alter table adam_member_price add price_special decimal(8, 2) null comment '特价:首次、首年优惠价' after price_fixed;
# 会员码表调整
alter table adam_member_code modify state tinyint null comment '状态[0-可用|1-已用|2-无效|3-过期|4-失效|5-退回]';
create index idx_amember_code_id on adam_member_code (code);
alter table adam_member_code add validity tinyint null comment '有效期(单位天)' after state;
alter table adam_member_code add effect_at datetime(3) null comment '生效时间' after validity;
alter table adam_member_code add expire_at datetime(3) null comment '过期时间' after effect_at;
alter table adam_member_code add operator varchar(64) null comment 'type=2时记录创建人' after expire_at;
# 订单
alter table adam_member_order modify state tinyint null comment '订单状态:0-未支付,1-已支付,2-已关闭,3-超时付,4-退款中,5-已退款';
alter table adam_member_order modify pay_no varchar(64) null comment '支付中心支付CODE';
alter table adam_member_order add payment_id varchar(64) null comment '支付中心三方支付ID' after pay_no;
alter table adam_member_order add area varchar(100) null comment '地区' after birthday;
# 会员退款
drop table if exists adam_member_refund;
create table adam_member_refund
(
mid bigint unsigned auto_increment primary key,
refund_no varchar(64) comment '退款请求编号',
order_no varchar(64) not null comment '对应支付中心order_code',
refund_price decimal(8, 2) comment '退款金额',
refund_reason varchar(200) comment '退款描述',
renewable tinyint comment '继续购买[1-可以|2-不可]',
refund_state tinyint comment '退款状态[0-发起退款|1-已退款|2-关闭|3-退款失败|9-退款中]',
# payment_type varchar(30) comment '支付渠道(即UPPER(CONCAT(device_from,pay_type)))',
repay_no varchar(64) comment '支付中心退款编号',
repay_reason varchar(200) comment '支付中心退款描述',
refund_at datetime(3) comment '退款时间',
operator varchar(64) comment '操作人',
created_at datetime(3) not null,
updated_at datetime(3),
comment varchar(255)
) engine = InnoDB comment '会员退款';
create unique index uidx_adam_member_refund_id on adam_member_refund (refund_no);
# 添加权益管理(关联会员券)
drop table if exists adam_member_rights;
create table adam_member_rights
(
mid bigint unsigned auto_increment primary key,
mrights_id varchar(64) not null,
member_id varchar(64) comment '会员类型id',
state tinyint comment '权益状态[0-INIT|1-NORMAL|2-INVALID]',
seq_no smallint comment '排列序号',
title varchar(50) not null comment '权益标题',
sub_title varchar(200) comment '副标题',
label varchar(50) comment '标注',
cover varchar(255) comment '图片标识',
detail text comment '详情内容',
comment varchar(255)
) engine = InnoDB comment '会员权益配置';
create unique index uidx_adam_member_rights_id on adam_member_rights (mrights_id);
-- >>------------------------------------------------------------------------------------ |20210918社交相关
# 用户业务服务账号表
drop table if exists adam_user_busi_acct;
create table adam_user_busi_acct
(
mid bigint unsigned auto_increment primary key,
uid varchar(64) not null,
busi varchar(20) comment '业务服务平台',
uuid varchar(64) comment '业务服务ID',
work varchar(64) comment '业务服务模块',
ppwd varchar(64) comment '业务服务密码',
state tinyint comment '1-NORMAL,2-INVALID',
created_at datetime not null,
updated_at datetime,
comment text
) engine = InnoDB comment '用户业务服务账号表';
create index idx_adam_user_busi_acct_uid on adam_user_busi_acct (uid);
# -- >>------------------------------------------------------------------------------------ |20210817会员与券改版
# 券发放管理
drop table if exists candy_mgt_coupon;
......@@ -49,11 +139,11 @@ create table candy_mgt_coupon
mid bigint unsigned auto_increment primary key,
mcoupon_id varchar(64) not null,
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint comment '发放状态[0-未发放|1-已发放|2-无效|9-发放中]',
state tinyint comment '发放状态[0-未发放|1-已发放|2-无效|3-已取消|9-发放中|10-会员礼包初始模版]',
# bind_type smallint comment '领取方式[0-用户输入兑换|1-发放至用户]',
event_amt int comment '发放量',
event_type tinyint comment '发放类型[1-会员|2-手机号|10-全体用户]',
event_type tinyint comment '发放类型[0-保留|1-会员|2-手机号|10-全体用户]',
event_limit text comment '`发放类型`为2-手机号时发放手机号以,分隔',
event_at datetime(3) comment '发放时间(立即-当前时间+3分钟|预约-点选时间)',
......@@ -63,7 +153,7 @@ create table candy_mgt_coupon
comment text
) engine InnoDB comment '券发放管理';
create unique index uidx_candy_mgt_coupon_id on candy_mgt_coupon (mcoupon_id);
create index idx_candy_mgt_coupon_id on candy_mgt_coupon (mcoupon_id);
# 券基础信息
......@@ -129,12 +219,14 @@ create table candy_coupon_code
mid bigint unsigned auto_increment primary key,
ccode varchar(64) not null comment '券码',
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint comment '状态[0-未使用|1-已使用|2-失效|3-退回]',
state tinyint comment '状态[0-可用|1-已用|2-无效|3-过期|4-失效|5-退回]',
redeem_uid varchar(64) comment '兑换用户UID',
redeem_mobile varchar(64) comment '兑换用户手机号',
redeem_at datetime(3) comment '兑换时间',
redeem_start datetime(3) comment '兑换开放时间',
redeem_stop datetime(3) comment '兑换停止时间',
created_at datetime(3) not null,
updated_at datetime(3),
......@@ -156,10 +248,33 @@ create table candy_user_coupon
ccode varchar(64) comment '券码~candy_coupon_code.ccode',
bind_at datetime(3) comment '激活时间',
dued_at datetime(3) comment '到期时间',
used_at datetime(3) comment '使用时间',
used_for varchar(255) comment '用于记录购买的内容',
created_at datetime(3) not null,
updated_at datetime(3),
comment varchar(255)
) engine = InnoDB comment '用户券信息';
create unique index uidx_candy_user_coupon_id on candy_user_coupon (ucoupon_id);
create index idx_candy_ucoupon_uid_state on candy_user_coupon (uid, state);
# 公有券信息
drop table if exists candy_common_coupon;
create table candy_common_coupon
(
mid bigint unsigned auto_increment primary key,
ccoupon_id varchar(64) not null,
mcoupon_id varchar(64) not null comment '~candy_mgt_coupon.mcoupon_id',
coupon_id varchar(64) not null comment '~candy_coupon.coupon_id',
state tinyint comment '公有券状态[1-可用|2-无效|3-已过期]',
ranged tinyint comment '公有券范围(~candy_mgt_coupon.event_type)',
operator varchar(64) not null comment '操作人',
created_at datetime(3) not null,
updated_at datetime(3),
comment varchar(255)
) engine = InnoDB comment '公有券信息';
-- >>------------------------------------------------------------------------------------
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment