1. add lottery
This commit is contained in:
2026-02-14 16:31:51 +08:00
parent f5a9d171e0
commit e1105dae89
20 changed files with 1421 additions and 35 deletions

View File

@@ -78,21 +78,20 @@ INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark,
VALUES (2020766604569534468, 2020766458167353346, 'notice_type', '3', 'Market用户通知', 2, '', 0, 1, 0);
--- 福利积分 benefit_point
DROP TABLE IF EXISTS benefit_point;
create table benefit_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
version int4 default 1,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
status int4 default 1,
is_deleted int4 default 0
);
@@ -406,20 +405,20 @@ alter table user_commission_log
DROP TABLE IF EXISTS market_commission_account;
create table market_commission_account
(
id int8 not null primary key,
account_name varchar(128), -- 账户名称
account_code varchar(64), -- 账户代码
account_type int4, -- 账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金
amount decimal(14, 2) default 0, -- 账户总余额
version int4 default 1,
remark varchar(200),
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
id int8 not null primary key,
account_name varchar(128), -- 账户名称
account_code varchar(64), -- 账户代码
account_type int4, -- 账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金
amount decimal(14, 2) default 0, -- 账户总余额
version int4 default 1,
remark varchar(200),
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
create index idx_mca_code
@@ -446,14 +445,53 @@ comment on column market_commission_account.is_deleted is '是否已删除';
alter table market_commission_account
owner to yicha1lu;
---------------------------------------insert start
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017485441885196290, '商品成本账户', 'COMMISSION_GOODS_COST', '0','0.0000', 1, '商品成本账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:29:47', 1123598821738675201, '2026-01-31 14:30:16.04', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017485893100032002, '分发商城积分账户', 'COMMISSION_USER_POINT_LOG', '1', '0.0000', 1, '分发商城积分账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:31:34.663', 1123598821738675201, '2026-01-31 14:31:34.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486037128237058, '分发直推人佣金账户', 'COMMISSION_DIRECT_PUSH', '2', '0.0000', 1,'分发直推人佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:32:08.998', 1123598821738675201, '2026-01-31 14:32:08.998', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486179294171138, '运营账户', 'COMMISSION_OPERATION', '3','0.0000', 1, '运营账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:32:42.889', 1123598821738675201, '2026-01-31 14:32:42.889', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486299502923778, '分发广告补贴账户', 'COMMISSION_ADVERTISING', '4','0.0000', 1, '分发广告补贴账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:33:11.552', 1123598821738675201, '2026-01-31 14:33:11.552', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486437340336130, '分发服务商佣金账户', 'COMMISSION_SERVICE_PROVIDER','5', '0.0000', 1, '分发服务商佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:33:44.407', 1123598821738675201, '2026-01-31 14:33:44.407', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486568441696258, '分发极差代理佣金账户', 'COMMISSION_AGENCY', '6','0.0000', 1, '分发极差代理佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:34:15.663', 1123598821738675201, '2026-01-31 14:34:15.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type" , "amount", "version", "remark" , "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted") VALUES (2017486664117964802, '联创佣金账户', 'COMMISSION_CO_CREATOR', '7','0.0000', 1, '联创佣金账户',1123598821738675201, 1123598813738675201, '2026-01-31 14:34:38.479', 1123598821738675201, '2026-01-31 14:34:38.479', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017485441885196290, '商品成本账户', 'COMMISSION_GOODS_COST', '0', '0.0000', 1, '商品成本账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:29:47', 1123598821738675201, '2026-01-31 14:30:16.04',
1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017485893100032002, '分发商城积分账户', 'COMMISSION_USER_POINT_LOG', '1', '0.0000', 1, '分发商城积分账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:31:34.663', 1123598821738675201,
'2026-01-31 14:31:34.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486037128237058, '分发直推人佣金账户', 'COMMISSION_DIRECT_PUSH', '2', '0.0000', 1, '分发直推人佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:32:08.998', 1123598821738675201,
'2026-01-31 14:32:08.998', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486179294171138, '运营账户', 'COMMISSION_OPERATION', '3', '0.0000', 1, '运营账户', 1123598821738675201,
1123598813738675201, '2026-01-31 14:32:42.889', 1123598821738675201, '2026-01-31 14:32:42.889', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486299502923778, '分发广告补贴账户', 'COMMISSION_ADVERTISING', '4', '0.0000', 1, '分发广告补贴账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:33:11.552', 1123598821738675201,
'2026-01-31 14:33:11.552', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486437340336130, '分发服务商佣金账户', 'COMMISSION_SERVICE_PROVIDER', '5', '0.0000', 1,
'分发服务商佣金账户', 1123598821738675201, 1123598813738675201, '2026-01-31 14:33:44.407', 1123598821738675201,
'2026-01-31 14:33:44.407', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486568441696258, '分发极差代理佣金账户', 'COMMISSION_AGENCY', '6', '0.0000', 1, '分发极差代理佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:34:15.663', 1123598821738675201,
'2026-01-31 14:34:15.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486664117964802, '联创佣金账户', 'COMMISSION_CO_CREATOR', '7', '0.0000', 1, '联创佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:34:38.479', 1123598821738675201,
'2026-01-31 14:34:38.479', 1, 0);
---------------------------------------insert end
@@ -485,7 +523,7 @@ create table market_commission_goods_cost_log
create index inx_mcgcl_uid
on market_commission_goods_cost_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index inx_mcgcl_aid
on market_commission_goods_cost_log (is_complete, account_id , type, statistical_date, create_time DESC);
on market_commission_goods_cost_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_goods_cost_log is '25%商品成本佣金流水表';
comment on column market_commission_goods_cost_log.id is '主键';
@@ -540,7 +578,7 @@ create table market_commission_user_point_log
create index idx_mcupl_uid
on market_commission_user_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcupl_aid
on market_commission_user_point_log (is_complete, account_id , type, statistical_date, create_time DESC);
on market_commission_user_point_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_user_point_log is '30%购买人获取用户积分佣金流水表';
comment on column market_commission_user_point_log.id is '主键';
@@ -596,7 +634,7 @@ create table market_commission_direct_push_log
create index idx_mcdpl_uid
on market_commission_direct_push_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcdpl_aid
on market_commission_direct_push_log (is_complete, account_id , type, statistical_date, create_time DESC);
on market_commission_direct_push_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_direct_push_log is '10%直推人佣金流水表';
comment on column market_commission_direct_push_log.id is '主键';
@@ -650,7 +688,7 @@ create table market_commission_operation_log
);
create index idx_mcol_aid
on market_commission_operation_log (is_complete, account_id, type, statistical_date , create_time DESC);
on market_commission_operation_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_operation_log is '5%运营佣金流水表';
comment on column market_commission_operation_log.id is '主键';
@@ -702,7 +740,7 @@ create table market_commission_advertising_log
);
create index idx_mcal_aid
on market_commission_advertising_log (is_complete, account_id, type, statistical_date , create_time DESC);
on market_commission_advertising_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_advertising_log is '5%广告补贴佣金流水表';
comment on column market_commission_advertising_log.id is '主键';
@@ -760,7 +798,7 @@ create table market_commission_service_provider_log
create index idx_mcspl_uid
on market_commission_service_provider_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcspl_aid
on market_commission_service_provider_log (is_complete, account_id , type, statistical_date, create_time DESC);
on market_commission_service_provider_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_service_provider_log is '5%服务商佣金流水表';
comment on column market_commission_service_provider_log.id is '主键';
@@ -819,7 +857,7 @@ create table market_commission_agency_log
create index idx_mc_agency_uid
on market_commission_agency_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mc_agency_aid
on market_commission_agency_log (is_complete, account_id , type, statistical_date, create_time DESC);
on market_commission_agency_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_agency_log is '15%极差代理佣金流水表';
comment on column market_commission_agency_log.id is '主键';
@@ -871,7 +909,7 @@ create table market_commission_co_creator_log
);
create index idx_mcccl_aid
on market_commission_co_creator_log (is_complete, account_id, statistical_date, type , create_time DESC);
on market_commission_co_creator_log (is_complete, account_id, statistical_date, type, create_time DESC);
comment on table market_commission_co_creator_log is '5%联创佣金流水表';
comment on column market_commission_co_creator_log.id is '主键';
@@ -918,7 +956,7 @@ create table user_market_package_daily_settlement --用户福利包每天结算
);
create index inx_umpds_uid
on user_market_package_daily_settlement (statistical_date ,is_complete,user_id );
on user_market_package_daily_settlement (statistical_date, is_complete, user_id);
COMMENT ON TABLE user_market_package_daily_settlement IS '用户福利包每天结算记录';
COMMENT ON COLUMN user_market_package_daily_settlement.id IS '主键';
@@ -939,3 +977,96 @@ comment on column user_market_package_daily_settlement.is_deleted is '是否已
alter table user_market_package_daily_settlement
owner to yicha1lu;
DROP TABLE IF EXISTS common_lottery_prize;
create table common_lottery_prize
(
id int8 not null primary key,
prize_name varchar(100),--奖品名称
prize_type int4, -- 类型:1=积分 2=优惠券 3=实物...
prize_value VARCHAR(255), -- 奖品内容(如积分数量、券码等)
probability DECIMAL(5, 4), -- 中奖概率(如 0.05 = 5%)
stock int4, -- 总库存(-1 表示无限)
daily_limit int4, -- 每日发放上限
sort_order int4, -- 排序(用于前端展示顺序)
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1, -- 状态:0=下架 1=上架,
is_deleted int4 default 0
);
COMMENT ON TABLE common_lottery_prize IS '奖品配置表';
COMMENT ON COLUMN common_lottery_prize.id IS '主键';
COMMENT ON COLUMN common_lottery_prize.prize_name IS '奖品名称';
COMMENT ON COLUMN common_lottery_prize.prize_type IS '奖品类型';
COMMENT ON COLUMN common_lottery_prize.prize_value IS '奖品内容';
COMMENT ON COLUMN common_lottery_prize.probability IS '中奖概率(如 0.05 = 5%)';
COMMENT ON COLUMN common_lottery_prize.stock IS '总库存(-1 表示无限)';
COMMENT ON COLUMN common_lottery_prize.daily_limit IS '每日发放上限';
COMMENT ON COLUMN common_lottery_prize.sort_order IS '排序(用于前端展示顺序)';
COMMENT ON COLUMN common_lottery_prize.remark IS '备注';
comment on column common_lottery_prize.create_user is '创建人';
comment on column common_lottery_prize.create_dept is '创建部门';
comment on column common_lottery_prize.create_time is '创建时间';
comment on column common_lottery_prize.update_user is '修改人';
comment on column common_lottery_prize.update_time is '修改时间';
comment on column common_lottery_prize.status is '状态:0=下架 1=上架';
comment on column common_lottery_prize.is_deleted is '是否已删除';
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022583456075808770', '1123598815738675201', 'lotteryPrize', '奖品配置表', 'menu', '/common/lotteryPrize', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022583456075808771', '2022583456075808770', 'lotteryPrize_add', '新增', 'add', '/common/lotteryPrize/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022583456075808772', '2022583456075808770', 'lotteryPrize_edit', '修改', 'edit', '/common/lotteryPrize/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022583456075808773', '2022583456075808770', 'lotteryPrize_delete', '删除', 'delete', '/api/blade-lotteryprize/lotteryPrize/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022583456075808774', '2022583456075808770', 'lotteryPrize_view', '查看', 'view', '/common/lotteryPrize/view', 'file-text', 4, 2, 2, 1, NULL, 0);
DROP TABLE IF EXISTS common_lottery_record;
create table common_lottery_record
(
id int8 not null primary key,
user_id int8, -- 用户id
prize_id int8, -- 中奖奖品ID(null 表示未中奖/谢谢参与)
points_used decimal(14, 2) default 0, -- 消耗积分
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 0, --0=未发放 1=已发放 2=发放失败
is_deleted int4 default 0
);
COMMENT ON TABLE common_lottery_record IS '抽奖记录表';
COMMENT ON COLUMN common_lottery_record.id IS '主键';
COMMENT ON COLUMN common_lottery_record.user_id IS '用户id';
COMMENT ON COLUMN common_lottery_record.prize_id IS '中奖奖品ID(null 表示未中奖/谢谢参与)';
COMMENT ON COLUMN common_lottery_record.points_used IS '消耗积分';
COMMENT ON COLUMN common_lottery_record.remark IS '备注';
comment on column common_lottery_record.create_user is '创建人';
comment on column common_lottery_record.create_dept is '创建部门';
comment on column common_lottery_record.create_time is '创建时间';
comment on column common_lottery_record.update_user is '修改人';
comment on column common_lottery_record.update_time is '修改时间';
comment on column common_lottery_record.status is '0=未发放 1=已发放 2=发放失败';
comment on column common_lottery_record.is_deleted is '是否已删除';
create index idx_clr_uc on common_lottery_record (user_id, is_deleted, create_time desc);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022588119768522753', '1123598815738675201', 'lotteryRecord', '抽奖记录表', 'menu', '/common/lotteryRecord', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022588119768522754', '2022588119768522753', 'lotteryRecord_add', '新增', 'add', '/common/lotteryRecord/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022588119768522755', '2022588119768522753', 'lotteryRecord_edit', '修改', 'edit', '/common/lotteryRecord/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022588119768522756', '2022588119768522753', 'lotteryRecord_delete', '删除', 'delete', '/api/blade-lotteryprize/lotteryRecord/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022588119768522757', '2022588119768522753', 'lotteryRecord_view', '查看', 'view', '/common/lotteryRecord/view', 'file-text', 4, 2, 2, 1, NULL, 0);