|
@@ -30,6 +30,9 @@ CREATE TABLE IF NOT EXISTS users (
|
|
|
mascot VARCHAR(20) DEFAULT NULL COMMENT 'AI助手形象: xibao(浠宝)/fubao(福宝)',
|
|
mascot VARCHAR(20) DEFAULT NULL COMMENT 'AI助手形象: xibao(浠宝)/fubao(福宝)',
|
|
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
|
|
+ butler_status VARCHAR(20) COMMENT '管家状态: null/pending/approved/rejected',
|
|
|
|
|
+ butler_info TEXT COMMENT '管家资质信息(JSON)',
|
|
|
|
|
+ butler_approved_at DATETIME COMMENT '管家认证通过时间',
|
|
|
INDEX idx_openid (openid),
|
|
INDEX idx_openid (openid),
|
|
|
INDEX idx_family_id (family_id),
|
|
INDEX idx_family_id (family_id),
|
|
|
INDEX idx_phone (phone)
|
|
INDEX idx_phone (phone)
|
|
@@ -2821,3 +2824,65 @@ CREATE TABLE IF NOT EXISTS supply_hierarchy_change_request (
|
|
|
KEY idx_system_applicant (system_id, applicant_id),
|
|
KEY idx_system_applicant (system_id, applicant_id),
|
|
|
KEY idx_status (status)
|
|
KEY idx_status (status)
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商更换上级申请表';
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商更换上级申请表';
|
|
|
|
|
+
|
|
|
|
|
+CREATE TABLE IF NOT EXISTS butler_profiles (
|
|
|
|
|
+ id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
|
+ user_id BIGINT NOT NULL COMMENT '用户ID',
|
|
|
|
|
+ tier VARCHAR(10) COMMENT '服务等级: L1/L2',
|
|
|
|
|
+ status VARCHAR(20) DEFAULT 'pending' COMMENT '状态: pending/approved/rejected',
|
|
|
|
|
+ member_count INT DEFAULT 0 COMMENT '当前服务家庭数',
|
|
|
|
|
+ max_members INT DEFAULT 50 COMMENT '最大服务家庭上限',
|
|
|
|
|
+ annual_fee_l1 BIGINT COMMENT '年费L1档(P点)',
|
|
|
|
|
+ annual_fee_l2 BIGINT COMMENT '年费L2档(P点)',
|
|
|
|
|
+ description TEXT COMMENT '个人简介',
|
|
|
|
|
+ certificates TEXT COMMENT '资质证书URL(JSON数组)',
|
|
|
|
|
+ reject_reason VARCHAR(500) COMMENT '审核拒绝原因',
|
|
|
|
|
+ commission_rate_l1 INT DEFAULT 1000 COMMENT '年度分佣比例L1(basis points,10000=100%)',
|
|
|
|
|
+ commission_rate_l2 INT DEFAULT 5000 COMMENT '年度分佣比例L2(basis points,10000=100%)',
|
|
|
|
|
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
|
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
|
|
+ approved_at DATETIME COMMENT '审核通过时间',
|
|
|
|
|
+ UNIQUE KEY uk_user_id (user_id),
|
|
|
|
|
+ INDEX idx_status (status),
|
|
|
|
|
+ INDEX idx_tier (tier)
|
|
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管家服务提供商档案';
|
|
|
|
|
+
|
|
|
|
|
+CREATE TABLE IF NOT EXISTS butler_service_records (
|
|
|
|
|
+ id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
|
+ butler_id BIGINT NOT NULL COMMENT '管家用户ID',
|
|
|
|
|
+ member_user_id BIGINT NOT NULL COMMENT '会员用户ID',
|
|
|
|
|
+ subscription_id BIGINT COMMENT '关联订阅记录ID(年费服务时)',
|
|
|
|
|
+ service_type VARCHAR(20) NOT NULL COMMENT '服务类型: annual/per_session',
|
|
|
|
|
+ amount_p BIGINT NOT NULL COMMENT '服务金额(P点)',
|
|
|
|
|
+ platform_fee_p BIGINT DEFAULT 0 COMMENT '平台留成(P点)',
|
|
|
|
|
+ butler_amount_p BIGINT DEFAULT 0 COMMENT '管家所得(P点)',
|
|
|
|
|
+ member_tier VARCHAR(10) COMMENT '会员订阅级别: L1/L2',
|
|
|
|
|
+ year_month VARCHAR(7) COMMENT '结算年月 YYYY-MM',
|
|
|
|
|
+ remark VARCHAR(500) COMMENT '备注',
|
|
|
|
|
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
|
+ INDEX idx_butler_id (butler_id),
|
|
|
|
|
+ INDEX idx_member_user_id (member_user_id),
|
|
|
|
|
+ INDEX idx_year_month (year_month),
|
|
|
|
|
+ INDEX idx_service_type (service_type)
|
|
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管家服务记录';
|
|
|
|
|
+
|
|
|
|
|
+CREATE TABLE IF NOT EXISTS butler_commission_settlements (
|
|
|
|
|
+ id BIGINT AUTO_INCREMENT PRIMARY KEY,
|
|
|
|
|
+ butler_id BIGINT NOT NULL COMMENT '管家用户ID',
|
|
|
|
|
+ year_month VARCHAR(7) NOT NULL COMMENT '结算年月 YYYY-MM',
|
|
|
|
|
+ member_count INT DEFAULT 0 COMMENT '本月服务家庭数',
|
|
|
|
|
+ annual_base_amount_p BIGINT DEFAULT 0 COMMENT '年费基准总额(P点)',
|
|
|
|
|
+ annual_butler_amount_p BIGINT DEFAULT 0 COMMENT '年费-管家所得(P点)',
|
|
|
|
|
+ annual_platform_amount_p BIGINT DEFAULT 0 COMMENT '年费-平台留成(P点)',
|
|
|
|
|
+ per_session_total_p BIGINT DEFAULT 0 COMMENT '按次服务总金额(P点)',
|
|
|
|
|
+ per_session_platform_total_p BIGINT DEFAULT 0 COMMENT '按次-平台留成(P点)',
|
|
|
|
|
+ per_session_butler_total_p BIGINT DEFAULT 0 COMMENT '按次-管家所得(P点)',
|
|
|
|
|
+ total_butler_amount_p BIGINT DEFAULT 0 COMMENT '本月管家总所得(P点)',
|
|
|
|
|
+ status VARCHAR(20) DEFAULT 'pending' COMMENT '结算状态: pending/paid',
|
|
|
|
|
+ settled_at DATETIME COMMENT '确认发放时间',
|
|
|
|
|
+ settled_by BIGINT COMMENT '结算确认人',
|
|
|
|
|
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
|
+ UNIQUE KEY uk_butler_month (butler_id, year_month),
|
|
|
|
|
+ INDEX idx_status (status),
|
|
|
|
|
+ INDEX idx_year_month (year_month)
|
|
|
|
|
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管家月度佣金结算单';
|