/*
 Navicat Premium Data Transfer

 Source Server         : dev
 Source Server Type    : MySQL
 Source Server Version : 80040
 Source Host           : localhost:3306
 Source Schema         : ff-admin

 Target Server Type    : MySQL
 Target Server Version : 80040
 File Encoding         : 65001

 Date: 22/10/2024 14:03:00
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for ff_agent_level
-- ----------------------------
DROP TABLE IF EXISTS `ff_agent_level`;
CREATE TABLE `ff_agent_level`  (
  `id` bigint NOT NULL COMMENT '主键id',
  `level_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '代理等级名称',
  `level` tinyint NULL DEFAULT NULL COMMENT '等级',
  `total_commission` decimal(10, 0) NULL DEFAULT NULL COMMENT '晋升等级佣金标准',
  `icon_url` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '图片地址',
  `default_status` tinyint NULL DEFAULT NULL COMMENT '默认状态',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '代理等级表' ROW_FORMAT = Dynamic;

ALTER TABLE `ff_agent_level` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;


-- ----------------------------
-- Records of ff_agent_level
-- ----------------------------
INSERT INTO `ff_agent_level` VALUES (1, 'LV1', 1, 0, 'data:image/png;base64, ', 1, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得0佣金的代理');
INSERT INTO `ff_agent_level` VALUES (2, 'LV2', 2, 100, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得100佣金的代理');
INSERT INTO `ff_agent_level` VALUES (3, 'LV3', 3, 300, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得300佣金的代理');
INSERT INTO `ff_agent_level` VALUES (4, 'LV4', 4, 500, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得500佣金的代理');
INSERT INTO `ff_agent_level` VALUES (5, 'LV5', 5, 800, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得800佣金的代理');
INSERT INTO `ff_agent_level` VALUES (6, 'LV6', 6, 1000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得1000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (7, 'LV7', 7, 10000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得10000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (8, 'LV8', 8, 30000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得30000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (9, 'LV9', 9, 50000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得50000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (10, 'LV10', 10, 80000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得80000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (11, 'LV11', 11, 100000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得100000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (12, 'LV12', 12, 1000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得1000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (13, 'LV13', 13, 3000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得3000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (14, 'LV14', 14, 5000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得5000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (15, 'LV15', 15, 8000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得8000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (16, 'LV16', 16, 10000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得10000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (17, 'LV17', 17, 100000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得100000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (18, 'LV18', 18, 300000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得300000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (19, 'LV19', 19, 500000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得500000000佣金的代理');
INSERT INTO `ff_agent_level` VALUES (20, 'LV20', 20, 800000000, '', 0, '', '2024-10-24 17:24:35', '', '2024-10-24 17:29:18', '晋级需再获得800000000佣金的代理');

SET FOREIGN_KEY_CHECKS = 1;

DROP TABLE IF EXISTS `ff_agent_mode`;
CREATE TABLE `ff_agent_mode`  (
  `id` bigint NOT NULL COMMENT '主键id',
  `mode_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '代理模式名称',
  `pattern_source` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模式来源',
  `settle_duration` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '结算周期',
  `calc_performance` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '佣金计算依据',
  `apply_mode` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '申请方式',
  `calc_level_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '代理佣金计算层级',
  `calc_mode` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '计算方式',
  `calc_range` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '业绩计算范围',
  `calc_ext_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '越级额外佣金类型',
  `calc_ext_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '赠送比例',
  `tutorial_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '推广教程配置类型',
  `tutorial_contents` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '推广教程配置自定义模式下内容',
  `default_status` tinyint NULL DEFAULT 0 COMMENT '是否默认(0非默认,1默认)',
  `enable_status` tinyint NULL DEFAULT 0 COMMENT '启用(0未启用,1启用)',
  `last_settle_day` datetime NULL DEFAULT NULL COMMENT '上周期结算时间',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '代理模式表' ROW_FORMAT = DYNAMIC;

ALTER TABLE `ff_agent_mode` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;

INSERT INTO `ff_agent_mode` VALUES (1, '一级净盈利', '1', '3', '2', '0', '1', '0', '1', '0', 0.00, '0', NULL, 0, 0, NULL, '', '2024-10-23 10:24:35', '', '2024-10-23 15:54:19', NULL);
INSERT INTO `ff_agent_mode` VALUES (2, '三级净盈利', '1', '3', '2', '0', '3', '0', '1', '2', 0.00, '0', NULL, 1, 0, NULL, '', '2024-10-23 10:24:35', '', '2024-10-23 11:36:01', NULL);
INSERT INTO `ff_agent_mode` VALUES (3, '全民代理', '1', '1', '2', '0', '999', '0', '1', '2', 30.00, '0', NULL, 0, 0, NULL, '', '2024-10-23 10:24:35', '', '2024-10-23 11:36:01', NULL);
INSERT INTO `ff_agent_mode` VALUES (4, '无限极差', '1', '1', '2', '0', '999', '0', '1', '4', 0.00, '0', NULL, 0, 0, NULL, '', '2024-10-23 10:24:35', '', '2024-10-23 11:36:01', NULL);
INSERT INTO `ff_agent_mode` VALUES (5, '一级代理', '1', '1', '2', '0', '1', '0', '1', '0', 0.00, '0', NULL, 0, 0, NULL, '', '2024-10-23 10:24:35', '', '2024-10-23 11:36:01', NULL);

-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('代理模式', '3051', '1', 'agentMode', 'agent/agentMode/index', 1, 0, 'C', '0', '0', 'agent:agentMode:list', '#', 'admin', sysdate(), '', null, '代理模式菜单');

INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10000, '模式来源', 'ff_pattern_source', '0', 'admin', '2024-10-22 06:26:19', 'admin', '2024-10-22 06:26:40', '模式来源');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10000, 1, '系统自带', '1', 'ff_pattern_source', NULL, 'default', 'N', '0', 'admin', '2024-10-22 06:32:33', 'admin', '2024-10-22 06:32:41', '');
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10001, 2, '自定义', '2', 'ff_pattern_source', NULL, 'default', 'N', '0', 'admin', '2024-10-22 06:33:05', '', NULL, NULL);


INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10001, '代理佣金计算层级', 'ff_calc_level_type', '0', 'admin', '2024-10-22 06:42:11', '', NULL, '代理佣金计算层级');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10002, 1, '只算一级', '1', 'ff_calc_level_type', NULL, 'default', 'N', '0', 'admin', '2024-10-22 06:43:00', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10003, 2, '最多三级', '3', 'ff_calc_level_type', NULL, 'default', 'N', '0', 'admin', '2024-10-22 06:43:14', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10004, 3, '无数级', '999', 'ff_calc_level_type', NULL, 'default', 'N', '0', 'admin', '2024-10-22 06:43:40', '', NULL, NULL);


INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10002, '申请方式', 'ff_apply_mode', '0', 'admin', '2024-10-22 06:54:08', 'admin', '2024-10-22 06:54:13', '申请方式');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10005, 0, '直接生效', '0', 'ff_apply_mode', NULL, 'default', 'N', '0', 'admin', '2024-10-22 06:54:46', '', NULL, NULL);


INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10003, '结算周期', 'ff_settle_duration', '0', 'admin', '2024-10-22 06:59:57', '', NULL, '结算周期');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10006, 0, '日结', '1', 'ff_settle_duration', NULL, 'default', 'N', '0', 'admin', '2024-10-22 07:02:37', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10007, 1, '周结', '2', 'ff_settle_duration', NULL, 'default', 'N', '0', 'admin', '2024-10-22 07:02:53', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10008, 2, '月结', '3', 'ff_settle_duration', NULL, 'default', 'N', '0', 'admin', '2024-10-22 07:03:08', '', NULL, NULL);


INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10004, '佣金计算依据', 'ff_calc_performance', '0', 'admin', '2024-10-22 07:25:17', '', NULL, NULL);

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10009, 0, '有效投注', '0', 'ff_calc_performance', NULL, 'default', 'N', '0', 'admin', '2024-10-22 07:26:14', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10010, 1, '亏损金额', '1', 'ff_calc_performance', NULL, 'default', 'N', '0', 'admin', '2024-10-22 07:26:37', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10011, 2, '净盈利', '2', 'ff_calc_performance', NULL, 'default', 'N', '0', 'admin', '2024-10-22 07:27:09', '', NULL, NULL);


INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10005, '计算方式', 'ff_calc_mode', '0', 'admin', '2024-10-22 08:23:21', '', NULL, '计算方式');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10012, 0, '所有会员(综合盈利会员)', '0', 'ff_calc_mode', NULL, 'default', 'N', '0', 'admin', '2024-10-22 08:24:18', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10013, 1, '仅计算亏损会员', '1', 'ff_calc_mode', NULL, 'default', 'N', '0', 'admin', '2024-10-22 08:24:37', '', NULL, NULL);


INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10006, '业绩计算范围', 'ff_calc_range', '0', 'admin', '2024-10-22 08:26:04', '', NULL, '业绩计算范围');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10014, 0, '计算全部(含无效)', '0', 'ff_calc_range', NULL, 'default', 'N', '0', 'admin', '2024-10-22 08:51:44', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10015, 1, '只计算有效会员业绩', '1', 'ff_calc_range', NULL, 'default', 'N', '0', 'admin', '2024-10-22 08:52:27', '', NULL, NULL);

INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10007, '推广教程配置', 'ff_tutorial_type', '0', 'admin', '2024-10-22 08:56:58', '', NULL, '推广教程配置');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10016, 0, '系统自带', '0', 'ff_tutorial_type', NULL, 'default', 'N', '0', 'admin', '2024-10-22 08:57:35', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10017, 1, '自定义', '1', 'ff_tutorial_type', NULL, 'default', 'N', '0', 'admin', '2024-10-22 08:58:16', '', NULL, NULL);


INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10008, '越级额外佣金类型', 'ff_calc_ext_type', '0', 'admin', '2024-10-23 05:13:35', '', NULL, '越级额外佣金类型');

INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10018, 0, '-', '0', 'ff_calc_ext_type', NULL, 'default', 'N', '0', 'admin', '2024-10-23 05:14:46', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10019, 1, '比例中的比例(跨级部分会员承担)', '1', 'ff_calc_ext_type', NULL, 'default', 'N', '0', 'admin', '2024-10-23 05:15:40', 'admin', '2024-10-23 05:16:20', NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10020, 2, '比例中的比例(跨级部分站长承担)', '2', 'ff_calc_ext_type', NULL, 'default', 'N', '0', 'admin', '2024-10-23 05:16:16', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10021, 3, '站长额外固定赠送', '3', 'ff_calc_ext_type', NULL, 'default', 'N', '0', 'admin', '2024-10-23 05:16:44', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10022, 4, '比例中的比例(跨级部分站长承担)', '4', 'ff_calc_ext_type', NULL, 'default', 'N', '0', 'admin', '2024-10-23 05:18:59', '', NULL, NULL);

DROP TABLE IF EXISTS `ff_settlement_setting`;
CREATE TABLE `ff_settlement_setting`  (
  `id` bigint NOT NULL COMMENT '主键id',
  `commission_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '佣金领取时间类型',
  `receive_way` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '领取方式',
  `commission_start_time` time NULL DEFAULT NULL COMMENT '佣金领取开始时间',
  `commission_end_time` time NULL DEFAULT NULL COMMENT '佣金领取结束时间',
  `agent_audit_rate` decimal(10, 2) NULL DEFAULT NULL COMMENT '佣金稽核倍数',
  `min_valid_bet` decimal(10, 2) NULL DEFAULT NULL COMMENT '有效投注金额',
  `min_valid_recharge` decimal(10, 2) NULL DEFAULT NULL COMMENT '结算周期内充值金额',
  `day_commission_limit` decimal(10, 2) NULL DEFAULT NULL COMMENT '日结模式上限',
  `week_commission_limit` decimal(10, 2) NULL DEFAULT NULL COMMENT '周结模式上限',
  `month_commission_limit` decimal(10, 2) NULL DEFAULT NULL COMMENT '月结模式上限',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '结算设置表' ROW_FORMAT = DYNAMIC;

ALTER TABLE `ff_settlement_setting` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;

-- ----------------------------
-- Records of ff_settlement_setting
-- ----------------------------
INSERT INTO `ff_settlement_setting` VALUES (1, '1', '08:00:00', '23:59:59', 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, '', '2024-10-24 09:14:00', '', '2024-10-24 10:00:00', NULL);

INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10009, '佣金领取时间类型', 'ff_commission_type', '0', 'admin', '2024-10-23 09:36:14', '', NULL, '佣金领取时间类型');
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10023, 0, '每天', '1', 'ff_commission_type', NULL, 'default', 'N', '0', 'admin', '2024-10-23 09:36:31', '', NULL, NULL);

DROP TABLE IF EXISTS `ff_agent_info`;
CREATE TABLE `ff_agent_info`  (
  `id` bigint NOT NULL COMMENT '主键id',
  `agent_id` bigint NOT NULL COMMENT '代理id',
  `root_id` bigint NULL COMMENT '顶级代理id',
  `level` int COMMENT '所属层级',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '代理信息表' ROW_FORMAT = Dynamic;

ALTER TABLE `ff_agent_info` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;

DROP TABLE IF EXISTS `ff_agent_relation`;
CREATE TABLE `ff_agent_relation`  (
  `id` bigint NOT NULL COMMENT '主键id',
  `root_id` bigint NULL COMMENT '顶级代理id',
  `node_relation` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '节点关系',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '代理关系表' ROW_FORMAT = Dynamic;

ALTER TABLE `ff_agent_relation` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;

-- 按钮 SQL
INSERT INTO `ff-admin`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10007, '代理模式查询', 10006, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:agentMode:query', '#', 'admin', '2024-10-24 01:09:11', '', NULL, '');
INSERT INTO `ff-admin`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10008, '代理模式新增', 10006, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:agentMode:add', '#', 'admin', '2024-10-24 01:09:11', '', NULL, '');
INSERT INTO `ff-admin`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10009, '代理模式修改', 10006, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:agentMode:edit', '#', 'admin', '2024-10-24 01:09:11', '', NULL, '');
INSERT INTO `ff-admin`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10010, '代理模式删除', 10006, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:agentMode:remove', '#', 'admin', '2024-10-24 01:09:11', '', NULL, '');
INSERT INTO `ff-admin`.`sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10011, '代理模式导出', 10006, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:agentMode:export', '#', 'admin', '2024-10-24 01:09:11', '', NULL, '');


DROP TABLE IF EXISTS `ff_commission_info`;
CREATE TABLE `ff_commission_info`  (
                                       `id` bigint NOT NULL COMMENT '主键id',
                                       `member_id` bigint NOT NULL COMMENT '会员id',
                                       `currency_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '币种',
                                       `total_amount` decimal(10, 2) DEFAULT NULL COMMENT '累计佣金',
                                       `total_withdrawn` decimal(10, 2) DEFAULT NULL COMMENT '累计提现',
                                       `total_no_withdrawn` decimal(10, 2) DEFAULT NULL COMMENT '累计未提现',
                                       `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
                                       `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                       `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
                                       `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                       `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
                                       PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '佣金信息表' ROW_FORMAT = Dynamic;

ALTER TABLE `ff_commission_info` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;


DROP TABLE IF EXISTS `ff_commission_flow_detail`;
CREATE TABLE `ff_commission_flow_detail`  (
                                              `id` bigint NOT NULL COMMENT '主键id',
                                              `member_id` bigint NOT NULL COMMENT '会员id',
                                              `currency_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '币种',
                                              `amount` decimal(10, 2) DEFAULT NULL COMMENT '佣金',
                                              `withdrawn` decimal(10, 2) DEFAULT NULL COMMENT '提现金额',
                                              `settle_status` tinyint DEFAULT 0 COMMENT '结算状态(0未提现,1已提现)',
                                              `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
                                              `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                              `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
                                              `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                              `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
                                              PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '佣金流水明细表' ROW_FORMAT = Dynamic;

ALTER TABLE `ff_commission_flow_detail` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;

INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10010, '领取方式', 'ff_receive_way', '0', 'admin', '2024-11-01 05:23:51', '', NULL, '领取方式');
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10024, 0, '自动派发', '1', 'ff_receive_way', NULL, 'default', 'N', '0', 'admin', '2024-11-01 05:24:20', '', NULL, NULL);


ALTER TABLE `ff_agent_level`
    MODIFY COLUMN `total_commission` decimal(16, 2) NULL DEFAULT NULL COMMENT '晋升等级佣金标准' AFTER `level`;
ALTER TABLE `ff_settlement_setting`
    MODIFY COLUMN `min_valid_bet` decimal(16, 2) NULL DEFAULT NULL COMMENT '有效投注金额' AFTER `agent_audit_rate`;
ALTER TABLE `ff_settlement_setting`
    MODIFY COLUMN `min_valid_recharge` decimal(16, 2) NULL DEFAULT NULL COMMENT '结算周期内充值金额' AFTER `min_valid_bet`;
ALTER TABLE `ff_settlement_setting`
    MODIFY COLUMN `day_commission_limit` decimal(16, 2) NULL DEFAULT NULL COMMENT '日结模式上限' AFTER `min_valid_recharge`;
ALTER TABLE `ff_settlement_setting`
    MODIFY COLUMN `week_commission_limit` decimal(16, 2) NULL DEFAULT NULL COMMENT '周结模式上限' AFTER `day_commission_limit`;
ALTER TABLE `ff_settlement_setting`
    MODIFY COLUMN `month_commission_limit` decimal(16, 2) NULL DEFAULT NULL COMMENT '月结模式上限' AFTER `week_commission_limit`;
ALTER TABLE `ff_commission_info`
    MODIFY COLUMN `total_amount` decimal(16, 2) NULL DEFAULT NULL COMMENT '累计佣金' AFTER `currency_type`;
ALTER TABLE `ff_commission_info`
    MODIFY COLUMN `total_withdrawn` decimal(16, 2) NULL DEFAULT NULL COMMENT '累计提现' AFTER `total_amount`;
ALTER TABLE `ff_commission_info`
    MODIFY COLUMN `total_no_withdrawn` decimal(16, 2) NULL DEFAULT NULL COMMENT '累计未提现' AFTER `total_withdrawn`;
ALTER TABLE `ff_commission_flow_detail`
    MODIFY COLUMN `amount` decimal(16, 2) NULL DEFAULT NULL COMMENT '佣金' AFTER `currency_type`;
ALTER TABLE `ff_commission_flow_detail`
    MODIFY COLUMN `withdrawn` decimal(16, 2) NULL DEFAULT NULL COMMENT '提现金额' AFTER `amount`;

INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10011, '代理提佣方式', 'ff_commission_way', '0', 'admin', '2024-11-05 06:31:53', '', NULL, '代理提佣方式');
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10025, 0, '不限制(自由领取)', '0', 'ff_commission_way', NULL, 'default', 'N', '0', 'admin', '2024-11-05 06:32:13', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10026, 1, '禁止所有提佣(含下级，私下结算)', '1', 'ff_commission_way', NULL, 'default', 'N', '0', 'admin', '2024-11-05 06:32:23', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10027, 2, '禁止本人提佣(私下结算)', '2', 'ff_commission_way', NULL, 'default', 'N', '0', 'admin', '2024-11-05 06:32:34', '', NULL, NULL);

INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10012, '佣金返利类型', 'ff_rebate_type', '0', 'admin', '2024-11-05 09:16:42', '', NULL, '佣金返利类型');
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10028, 1, '有效投注', '1', 'ff_rebate_type', NULL, 'default', 'N', '0', 'admin', '2024-11-05 09:17:34', '', NULL, NULL);
INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10029, 2, '净盈利', '2', 'ff_rebate_type', NULL, 'default', 'N', '0', 'admin', '2024-11-05 09:18:02', '', NULL, NULL);


DROP TABLE IF EXISTS `ff_rebate_setting`;
CREATE TABLE `ff_rebate_setting`  (
      `id` bigint NOT NULL COMMENT '主键id',
      `game_type` bigint DEFAULT NULL COMMENT '游戏类型',
      `calc_performance` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '佣金计算依据',
      `valid_num` int DEFAULT NULL COMMENT '有效人数',
      `commission` decimal(16, 2) DEFAULT NULL COMMENT '佣金金额',
      `commission_rate` decimal(10, 2) DEFAULT NULL COMMENT '佣金比例',
      `min_amount` decimal(16, 2) DEFAULT NULL COMMENT '最小金额',
      `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
      `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
      `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
      `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
      `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
      PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '返佣设置表' ROW_FORMAT = Dynamic;

ALTER TABLE `ff_rebate_setting` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;

delete from sys_menu where menu_name like '返佣设置%';

INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10018, '返佣设置', 3051, 1, 'rebateSetting', 'agent/rebateSetting/index', NULL, '', 1, 0, 'C', '0', '0', 'agent:rebateSetting:list', '#', 'admin', '2024-11-06 03:28:17', '', NULL, '返佣设置菜单');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10019, '返佣设置查询', 10018, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:rebateSetting:query', '#', 'admin', '2024-11-06 03:28:17', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10020, '返佣设置新增', 10018, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:rebateSetting:add', '#', 'admin', '2024-11-06 03:28:17', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10021, '返佣设置修改', 10018, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:rebateSetting:edit', '#', 'admin', '2024-11-06 03:28:17', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10022, '返佣设置删除', 10018, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:rebateSetting:remove', '#', 'admin', '2024-11-06 03:28:17', '', NULL, '');
INSERT INTO `sys_menu` (`menu_id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `route_name`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (10023, '返佣设置导出', 10018, 5, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'agent:rebateSetting:export', '#', 'admin', '2024-11-06 03:28:17', '', NULL, '');

ALTER TABLE ff_agent_mode ADD COLUMN agent_model_type tinyint DEFAULT NULL COMMENT '代理模式类型' AFTER `pattern_source`;

ALTER TABLE ff_agent_info ADD COLUMN depth int COMMENT '深度(下级层数)' AFTER `level`;
ALTER TABLE ff_agent_info ADD COLUMN direct_num int COMMENT '直属数' AFTER `depth`;
ALTER TABLE ff_agent_info ADD COLUMN agent_num int COMMENT '代理总数' AFTER `direct_num`;
ALTER TABLE ff_agent_info ADD COLUMN member_num int COMMENT '所有下级的会员数量(下级总数)' AFTER `agent_num`;


ALTER TABLE ff_agent_level ADD COLUMN currency_type varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '币种' AFTER `level`;

DROP TABLE IF EXISTS `ff_agent_level_relation`;
CREATE TABLE `ff_agent_level_relation`  (
                                            `id` bigint NOT NULL COMMENT '主键id',
                                            `member_id` bigint NOT NULL COMMENT '会员id',
                                            `agent_level_id` bigint NOT NULL COMMENT '代理等级id',
                                            `currency_type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '币种',
                                            `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者',
                                            `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
                                            `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者',
                                            `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
                                            `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
                                            PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '代理等级关系表' ROW_FORMAT = Dynamic;

ALTER TABLE `ff_agent_level_relation` MODIFY COLUMN `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键id' FIRST;