feat: 迭代
This commit is contained in:
@@ -648,7 +648,7 @@ CREATE TABLE IF NOT EXISTS `merchant_accounts` (
|
||||
-- 3. 系统总账户表(记录整个系统的资金流入流出)
|
||||
CREATE TABLE IF NOT EXISTS `system_accounts` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户ID',
|
||||
`account_name` VARCHAR(50) NOT NULL COMMENT '账户名称(如:主账户)',
|
||||
`account_name` VARCHAR(50) NOT NULL COMMENT '账户名称(如:SYSTEM_MAIN)',
|
||||
`balance` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '可用余额(total_income - total_refund - total_withdrawn)',
|
||||
`total_income` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '累计收入(用户实付总额)',
|
||||
`total_refund` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '累计退款',
|
||||
@@ -665,7 +665,7 @@ CREATE TABLE IF NOT EXISTS `system_accounts` (
|
||||
-- 4. 平台账户表(记录平台净收益)
|
||||
CREATE TABLE IF NOT EXISTS `platform_accounts` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '账户ID',
|
||||
`account_name` VARCHAR(50) NOT NULL COMMENT '账户名称(如:主账户、备用账户)',
|
||||
`account_name` VARCHAR(50) NOT NULL COMMENT '账户名称(如:PLATFORM_MAIN、PLATFORM_BACKUP)',
|
||||
`balance` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '可用余额(平台净收益 = total_income - total_expense)',
|
||||
`frozen_balance` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '冻结余额(提现中)',
|
||||
`total_income` DECIMAL(12,2) NOT NULL DEFAULT 0.00 COMMENT '累计收入(服务费收入)',
|
||||
|
||||
@@ -4,12 +4,22 @@
|
||||
USE `rent_platform`;
|
||||
|
||||
-- ============================================================
|
||||
-- 1. 平台账户(必须首先创建)
|
||||
-- 1. 系统总账户(必须首先创建,用于资金守恒验证)
|
||||
-- ============================================================
|
||||
-- 注意:初始余额为0,如果有历史订单数据,请执行相应脚本进行余额修复
|
||||
-- account_name: SYSTEM_MAIN (系统主账户)
|
||||
INSERT INTO `system_accounts` (`account_name`, `balance`, `total_income`, `total_refund`, `total_withdrawn`, `status`)
|
||||
VALUES ('SYSTEM_MAIN', 0.00, 0.00, 0.00, 0.00, 'active')
|
||||
ON DUPLICATE KEY UPDATE `account_name` = 'SYSTEM_MAIN';
|
||||
|
||||
-- ============================================================
|
||||
-- 2. 平台账户(记录平台净收益)
|
||||
-- ============================================================
|
||||
-- 注意:初始余额为0,如果有历史订单数据,请执行 scripts/init-platform-account.sql 脚本进行余额修复
|
||||
-- account_name: PLATFORM_MAIN (平台主账户)
|
||||
INSERT INTO `platform_accounts` (`account_name`, `balance`, `frozen_balance`, `total_income`, `total_expense`, `status`)
|
||||
VALUES ('主账户', 0.00, 0.00, 0.00, 0.00, 'active')
|
||||
ON DUPLICATE KEY UPDATE `account_name` = '主账户';
|
||||
VALUES ('PLATFORM_MAIN', 0.00, 0.00, 0.00, 0.00, 'active')
|
||||
ON DUPLICATE KEY UPDATE `account_name` = 'PLATFORM_MAIN';
|
||||
|
||||
-- ============================================================
|
||||
-- 2. 平台管理员账号
|
||||
@@ -55,3 +65,12 @@ INSERT INTO `platform_configs` (`config_key`, `config_value`, `description`) VAL
|
||||
('sms_enabled', 'true', '是否启用短信通知'),
|
||||
('max_images_per_room', '20', '每个房源最大图片数'),
|
||||
('max_images_per_review', '9', '每条评价最大图片数');
|
||||
|
||||
-- ============================================================
|
||||
-- 7. 营销活动 - 邀请返现活动
|
||||
-- ============================================================
|
||||
INSERT INTO `mkt_activities` (`name`, `type`, `enabled`, `config`, `start_time`, `end_time`) VALUES
|
||||
('邀请好友返现活动', 'invite_cashback', 1,
|
||||
'{"firstOrderRate": 0.05, "secondOrderRate": 0.005, "minCashback": 0.01, "maxCashback": 1000, "withdrawThreshold": 10, "maxOrderIndex": 2}',
|
||||
NOW(), NULL)
|
||||
ON DUPLICATE KEY UPDATE `enabled` = 1;
|
||||
|
||||
Reference in New Issue
Block a user