This commit is contained in:
dengqichen 2025-11-18 11:15:18 +08:00
parent e7e875a010
commit 990172f559
2 changed files with 11 additions and 4 deletions

View File

@ -25,15 +25,16 @@ class AccountRepository {
billingDate, billingDate,
paymentCardNumber, paymentCardNumber,
paymentCountry, paymentCountry,
status status,
isOnSale
} = accountData; } = accountData;
const sql = ` const sql = `
INSERT INTO windsurf_accounts ( INSERT INTO windsurf_accounts (
email, password, first_name, last_name, registration_time, email, password, first_name, last_name, registration_time,
quota_used, quota_total, billing_days, billing_date, quota_used, quota_total, billing_days, billing_date,
payment_card_number, payment_country, status payment_card_number, payment_country, status, is_on_sale
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`; `;
const params = [ const params = [
@ -48,7 +49,8 @@ class AccountRepository {
billingDate || null, billingDate || null,
paymentCardNumber || null, paymentCardNumber || null,
paymentCountry || 'MO', paymentCountry || 'MO',
status || 'active' status || 'active',
isOnSale !== undefined ? isOnSale : false
]; ];
try { try {
@ -116,6 +118,10 @@ class AccountRepository {
updates.push('status = ?'); updates.push('status = ?');
params.push(accountData.status); params.push(accountData.status);
} }
if (accountData.isOnSale !== undefined) {
updates.push('is_on_sale = ?');
params.push(accountData.isOnSale);
}
if (updates.length === 0) { if (updates.length === 0) {
logger.warn('AccountRepository', 'No fields to update'); logger.warn('AccountRepository', 'No fields to update');

View File

@ -24,6 +24,7 @@ CREATE TABLE IF NOT EXISTS `windsurf_accounts` (
`payment_card_number` VARCHAR(20) COMMENT '支付卡号', `payment_card_number` VARCHAR(20) COMMENT '支付卡号',
`payment_country` VARCHAR(10) DEFAULT 'MO' COMMENT '支付国家代码', `payment_country` VARCHAR(10) DEFAULT 'MO' COMMENT '支付国家代码',
`status` ENUM('active', 'expired', 'error') DEFAULT 'active' COMMENT '账号状态', `status` ENUM('active', 'expired', 'error') DEFAULT 'active' COMMENT '账号状态',
`is_on_sale` BOOLEAN DEFAULT FALSE COMMENT '是否已上架销售',
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
UNIQUE KEY `uk_email` (`email`), UNIQUE KEY `uk_email` (`email`),