-- 用户中心会员设置
INSERT INTO `sys_member`(`id`, `level`, `total_consume`, `total_recommend`, `fee`, `experience`, `create_time`,
                         `update_time`)
SELECT 1,
       1,
       0.00000000,
       0,
       0.00000000,
       0,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `sys_member` WHERE `level` = 1);

INSERT INTO `sys_member`(`id`, `level`, `total_consume`, `total_recommend`, `fee`, `experience`, `create_time`,
                         `update_time`)
SELECT 2,
       2,
       0.00000000,
       0,
       0.00000000,
       0,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `sys_member` WHERE `level` = 2);

INSERT INTO `sys_member`(`id`, `level`, `total_consume`, `total_recommend`, `fee`, `experience`, `create_time`,
                         `update_time`)
SELECT 3,
       3,
       0.00000000,
       0,
       0.00000000,
       0,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `sys_member` WHERE `level` = 3);

INSERT INTO `sys_member`(`id`, `level`, `total_consume`, `total_recommend`, `fee`, `experience`, `create_time`,
                         `update_time`)
SELECT 4,
       4,
       0.00000000,
       0,
       0.00000000,
       0,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `sys_member` WHERE `level` = 4);

INSERT INTO `sys_member`(`id`, `level`, `total_consume`, `total_recommend`, `fee`, `experience`, `create_time`,
                         `update_time`)
SELECT 5,
       5,
       0.00000000,
       0,
       0.00000000,
       0,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `sys_member` WHERE `level` = 5);

-- 用户中心商户设置
INSERT INTO `merchant_config`(`id`, `level`, `membership_fee`, `service_fee`, `draw_proportion`, `create_time`,
                              `update_time`)
SELECT 1,
       1,
       0.00000000,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `merchant_config` WHERE `level` = 1);

INSERT INTO `merchant_config`(`id`, `level`, `membership_fee`, `service_fee`, `draw_proportion`, `create_time`,
                              `update_time`)
SELECT 2,
       2,
       0.00000000,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `merchant_config` WHERE `level` = 2);

INSERT INTO `merchant_config`(`id`, `level`, `membership_fee`, `service_fee`, `draw_proportion`, `create_time`,
                              `update_time`)
SELECT 3,
       3,
       0.00000000,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `level` FROM `merchant_config` WHERE `level` = 3);

-- 商户设置
INSERT INTO `platform_setting`(`id`, `set_event`, `set_result`, `create_time`, `update_time`)
SELECT 1,
       'user_delay_delivery',
       '1',
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `set_event` FROM `platform_setting` WHERE `set_event` = 'user_delay_delivery');

-- 运营中心推广佣金
INSERT INTO `opration_popularize_commission`(`id`, `sort`, `member_level`, `register_award`, `recommend_register_award`,
                                             `create_time`, `update_time`)
SELECT 1,
       1,
       1,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `sort` FROM `opration_popularize_commission` WHERE `sort` = 1);

INSERT INTO `opration_popularize_commission`(`id`, `sort`, `member_level`, `register_award`, `recommend_register_award`,
                                             `create_time`, `update_time`)
SELECT 2,
       2,
       2,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `sort` FROM `opration_popularize_commission` WHERE `sort` = 2);

INSERT INTO `opration_popularize_commission`(`id`, `sort`, `member_level`, `register_award`, `recommend_register_award`,
                                             `create_time`, `update_time`)
SELECT 3,
       3,
       3,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `sort` FROM `opration_popularize_commission` WHERE `sort` = 3);

INSERT INTO `opration_popularize_commission`(`id`, `sort`, `member_level`, `register_award`, `recommend_register_award`,
                                             `create_time`, `update_time`)
SELECT 4,
       4,
       4,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `sort` FROM `opration_popularize_commission` WHERE `sort` = 4);

INSERT INTO `opration_popularize_commission`(`id`, `sort`, `member_level`, `register_award`, `recommend_register_award`,
                                             `create_time`, `update_time`)
SELECT 5,
       5,
       5,
       0.00000000,
       0.00000000,
       REPLACE(unix_timestamp(current_timestamp(3)), '.', ''),
       REPLACE(unix_timestamp(current_timestamp(3)), '.', '')
FROM DUAL
WHERE NOT EXISTS(SELECT `sort` FROM `opration_popularize_commission` WHERE `sort` = 5);
