use zhangsiye_db;
alter table t_users
    add COLUMN `parent_id` int(11) NOT NULL DEFAULT 0 COMMENT '上级推荐用户' AFTER remember_token;
alter table t_users
    add COLUMN `become_child_at` timestamp NULL DEFAULT NULL COMMENT '成为下线时间' AFTER parent_id;
alter table t_users
    add COLUMN `total_income` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '收入' AFTER become_child_at;
alter table t_users
    add COLUMN `income` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '收入' AFTER total_income;
alter table t_users
    add COLUMN `share_qrcode` varchar(255) NOT NULL DEFAULT '' COMMENT '分享二维码' AFTER income;
alter table t_users
    add COLUMN `scene_code` varchar(255) NOT NULL DEFAULT '' COMMENT '情景CODE' AFTER share_qrcode;
alter table t_users
    add COLUMN `is_share` varchar(255) NOT NULL DEFAULT '' COMMENT '是否分销' AFTER remember_token;
alter table t_users
    add COLUMN `become_share_at` timestamp NULL DEFAULT NULL COMMENT '成为分销商时间' AFTER is_share;


drop TABLE if exists t_user_share;
CREATE TABLE `t_user_share`
(
    `id`         int(11) NOT NULL AUTO_INCREMENT,
    `user_id`    int(11) NOT NULL DEFAULT 0 COMMENT '用户',
    `child_id`   int(11) NOT NULL DEFAULT 0 COMMENT '二级ID',
    `order_type` tinyint(1) NOT NULL DEFAULT 0.00 COMMENT '1-充值VIP 2-充值金币',
    `order_id`   VARCHAR(30)    NOT NULL DEFAULT 0.00 COMMENT '订单号',
    `income`     decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '收入',
    `created_at` timestamp NULL DEFAULT NULL,
    `updated_at` timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='分销明细';

drop TABLE if exists t_user_withdraw;
CREATE TABLE `t_user_withdraw`
(
    `id`          int(11) NOT NULL AUTO_INCREMENT,
    `user_id`     int(11) NOT NULL DEFAULT 0 COMMENT '用户',
    `name`        VARCHAR(30)    NOT NULL DEFAULT 0 COMMENT '姓名',
    `phone_num`   VARCHAR(30)    NOT NULL DEFAULT 0 COMMENT '手机号',
    `type`        tinyint(11) NOT NULL DEFAULT 1 COMMENT '类型 1-微信',
    `bank_name`   varchar(50)    NOT NULL DEFAULT '' COMMENT '所属银行',
    `account`     varchar(50)    NOT NULL DEFAULT '' COMMENT '提现账号',
    `price`       decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现金额',
    `discount`    decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '手续费',
    `desc`        varchar(255)   NOT NULL DEFAULT '' COMMENT '提现备注',
    `status`      tinyint(4) NOT NULL DEFAULT 0 COMMENT '提现状态',
    `review_at`   timestamp NULL DEFAULT NULL COMMENT '审核时间',
    `withdraw_at` timestamp NULL DEFAULT NULL COMMENT '打款时间',
    `created_at`  timestamp NULL DEFAULT NULL,
    `updated_at`  timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='用户提现';

drop TABLE if exists t_share_config;
CREATE TABLE `t_share_config`
(
    `id`                int(11) NOT NULL AUTO_INCREMENT,
    `become_type`       tinyint(11) NOT NULL DEFAULT 1 COMMENT '成为分销商条件 1-无条件 2-对应会员 3-对应金币',
    `become_vip_id`     int(11) NOT NULL DEFAULT 1 COMMENT '成为分销商会员ID',
    `become_gold`       int(11) NOT NULL DEFAULT 1 COMMENT '成为分销商金币',
    `share_type`        tinyint(11) NOT NULL DEFAULT 1 COMMENT '类型 1-百分比 2-固定',
    `share_number`      decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '分销金额',
    `type`              tinyint(11) NOT NULL DEFAULT 1 COMMENT '类型 1-百分比 2-固定',
    `withdraw_discount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '提现手续费 百分比',
    `withdraw_desc`     varchar(255)   NOT NULL DEFAULT '' COMMENT '提现说明',
    `withdraw_min`      decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '最少提现额度',
    `withdraw_max`      decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '每日提现上限',
    `is_open`           tinyint(4) NOT NULL DEFAULT 1 COMMENT '是否开启分销',
    `created_at`        timestamp NULL DEFAULT NULL,
    `updated_at`        timestamp NULL DEFAULT NULL,
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='分销设置';



INSERT INTO `t_share_config`
VALUES (1, 3, 1, 3, 1, 0.00, 1, 2.00, '32131', 2.00, 2.00, 1, NULL, '2022-11-04 22:35:09');



ALTER TABLE `zhangsiye_db`.`t_pay_config`
    ADD COLUMN `wechat_mch_id` varchar(30) NULL COMMENT '商户ID' AFTER `wechat_app_key`,
ADD COLUMN `wechat_mch_key` varchar(255) NULL COMMENT '商户秘钥' AFTER `wechat_mch_id`;
