/* 配合汉鹏的新设计,重建身价相关数据表 */ -- 增加 会员身价变化类别表, 此表主要用于设置各种导致用户资产发生变化的行为的分值变化 -- 字段有id、类别码(数字类型,在java中对应常量)、类别名称、类别描述、变化值(就是签到身价加100那个100) CREATE TABLE `distri_social_status_change_category` ( `id` bigint NOT NULL COMMENT '会员身价变化类别id', `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '类别名称', -- `code` int NOT NULL DEFAULT -1 COMMENT '类别码', `variation_value` DOUBLE NOT NULL DEFAULT 0 COMMENT '身价点数在本类别操作的变化值', `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '描述', `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员身价变化类别表' ROW_FORMAT = Dynamic; insert into distri_social_status_change_category (id,name,variation_value,description) values(1,'本人注册用户',100,'注册用户,获得的初始身价值'); insert into distri_social_status_change_category (id,name,variation_value,description) values(2,'成功推荐新用户注册',100,'推荐了一个用户注册后,推荐人获得的身价值'); insert into distri_social_status_change_category (id,name,variation_value,description) values(3,'签到获取的基础身价值',10,'签到获取的最小身价值'); insert into distri_social_status_change_category (id,name,variation_value,description) values(4,'收藏一个商品获取的身价值',10,'收藏一个商品获取的身价值,同一商品,反复收藏只可获取一次身价值'); insert into distri_social_status_change_category (id,name,variation_value,description) values(5,'购物自得身价值',50,'购物金额乘于本参数,等于获取的身价值'); insert into distri_social_status_change_category (id,name,variation_value,description) values(6,'直推人购物,推荐人获得身价',0.5,'推荐人获取身价值=直推人购物金额*本倍数'); commit; -- 会员身价变化日志表 -- 字段有会员资产变化类别id、分值、操作时间、对象名(如 订单表名)、对象id(如 订单id)、是否已生效、计划生效时间、实际生效时间、描述 CREATE TABLE `distri_social_status_change_log` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '会员身价变化日志id', `social_status_change_category_id` bigint NOT NULL COMMENT '会员资产变化类别id',-- 新加字段 `variation_value` bigint NOT NULL COMMENT '身价点数在本类别操作的变化值', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间', `object_id` bigint NOT NULL DEFAULT 0 COMMENT '操作对应业务对象id,例如订单id', `user_id` bigint NOT NULL COMMENT '发生身价变化的用户7id', -- `effective` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已生效', `description` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '描述', -- `plan_effective_time` datetime NULL COMMENT '计划生效时间', -- `actual_effective_time` datetime NULL COMMENT '实际生效时间', `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员身价变化日志表' ROW_FORMAT = Dynamic; -- 会员收藏历史表 CREATE TABLE `distri_user_collect_before` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id', `product_spu_id` bigint NOT NULL COMMENT '收藏商品spu的id', `user_id` bigint NOT NULL COMMENT '收藏商品的用户ID', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间', `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户曾经收藏过什么商品的表' ROW_FORMAT = Dynamic; -- 会员签到日志表 CREATE TABLE `distri_user_sign_in_log` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后签到时间', `user_id` bigint NOT NULL COMMENT '签到的用户ID', `running_days` tinyint NOT NULL DEFAULT 0 COMMENT '连续签到天数', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间', `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户签到日志表' ROW_FORMAT = Dynamic; ALTER TABLE `distri_pt_profit_log` ADD COLUMN `max_available_points_amount` BIGINT ( 11 ) DEFAULT NULL COMMENT '最大可用积分变化值' AFTER `after_freeze_amount`, ADD COLUMN `after_max_available_points_amount` BIGINT ( 11 ) DEFAULT NULL COMMENT '最大可用积分额度' AFTER `max_available_points_amount`, ADD COLUMN `accumulated_quota_amount` BIGINT ( 11 ) DEFAULT NULL COMMENT '合赢奖超出额度' AFTER `after_max_available_points_amount`, ADD COLUMN `ancestor_quota_amount` BIGINT ( 11 ) DEFAULT NULL COMMENT '直推奖超出额度' AFTER `accumulated_quota_amount`; -- 增加 会员签到表 /* CREATE TABLE `distri_sign_in` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '会员签到表id', `user_id` bigint NOT NULL DEFAULT 0 COMMENT '会员用户id', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '签到时间', `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '店铺表' ROW_FORMAT = Dynamic; */