- Added a new entry for user interaction habit analysis based on agent transcripts, summarizing key insights into communication styles and preferences. - Updated project indices to reflect the latest developments, including the addition of a wallet balance feature and enhancements to the mini program's user interface for better user experience. - Improved the handling of loading states in the chapters page, ensuring a smoother user experience during data retrieval. - Implemented a gift payment sharing feature, allowing users to share payment requests with friends for collaborative purchases.
29 lines
1.1 KiB
SQL
29 lines
1.1 KiB
SQL
-- 余额相关表(新版迁移)
|
||
-- 执行:mysql -u user -p database < soul-api/scripts/add-balance-tables.sql
|
||
|
||
-- user_balances
|
||
CREATE TABLE IF NOT EXISTS user_balances (
|
||
user_id VARCHAR(50) PRIMARY KEY,
|
||
balance DECIMAL(10,2) DEFAULT 0,
|
||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||
|
||
-- balance_transactions
|
||
CREATE TABLE IF NOT EXISTS balance_transactions (
|
||
id VARCHAR(50) PRIMARY KEY,
|
||
user_id VARCHAR(50) NOT NULL,
|
||
type VARCHAR(20) NOT NULL,
|
||
amount DECIMAL(10,2) NOT NULL,
|
||
order_id VARCHAR(50) DEFAULT NULL,
|
||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||
INDEX idx_user_created (user_id, created_at)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||
|
||
-- orders 增加 payment_method
|
||
SET @col_exists = (SELECT COUNT(*) FROM information_schema.COLUMNS
|
||
WHERE table_schema = DATABASE() AND table_name = 'orders' AND column_name = 'payment_method');
|
||
SET @sql = IF(@col_exists = 0, 'ALTER TABLE orders ADD COLUMN payment_method VARCHAR(20) DEFAULT NULL AFTER referrer_id', 'SELECT 1');
|
||
PREPARE stmt FROM @sql;
|
||
EXECUTE stmt;
|
||
DEALLOCATE PREPARE stmt;
|