|
|
@@ -5081,5 +5081,33 @@ try {
|
|
|
|
|
|
// 迁移76: DanAssessmentResult添加structured_analysis字段(G3)
|
|
|
ensureColumn("dan_assessment_results", "structured_analysis", "TEXT COMMENT '结构化分析JSON'");
|
|
|
+
|
|
|
+
|
|
|
+ // 迁移77: 创建 pending_refund 表(待退款记录)
|
|
|
+ try {
|
|
|
+ jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS pending_refund (" +
|
|
|
+ "id BIGINT AUTO_INCREMENT PRIMARY KEY, " +
|
|
|
+ "user_id BIGINT NOT NULL COMMENT '用户ID', " +
|
|
|
+ "withdrawal_request_id BIGINT COMMENT '提现申请ID', " +
|
|
|
+ "amount INT NOT NULL COMMENT '退款金额(分)', " +
|
|
|
+ "attempt_count INT DEFAULT 0 COMMENT '当前尝试次数', " +
|
|
|
+ "max_attempts INT DEFAULT 10 COMMENT '最大重试次数', " +
|
|
|
+ "next_retry_time DATETIME COMMENT '下次重试时间', " +
|
|
|
+ "status VARCHAR(20) DEFAULT 'pending' COMMENT '状态: pending/processing/success/failed', " +
|
|
|
+ "failure_reason VARCHAR(500) COMMENT '失败原因', " +
|
|
|
+ "refunded_amount INT COMMENT '实际退款金额(分)', " +
|
|
|
+ "refunded_at DATETIME COMMENT '退款时间', " +
|
|
|
+ "remark VARCHAR(500) COMMENT '备注', " +
|
|
|
+ "created_at DATETIME DEFAULT CURRENT_TIMESTAMP, " +
|
|
|
+ "updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, " +
|
|
|
+ "INDEX idx_user_id (user_id), " +
|
|
|
+ "INDEX idx_status (status), " +
|
|
|
+ "INDEX idx_next_retry (next_retry_time), " +
|
|
|
+ "INDEX idx_withdrawal_request (withdrawal_request_id)" +
|
|
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='待退款记录表'");
|
|
|
+ log.info("已创建pending_refund表");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("创建pending_refund表失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|