Fix duplicate session billing and align pricing with DeepSeek ×3.

Serialize billSessionUsage with row locks, expose rates on recharge, add compensation script and admin usage views.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
John
2026-06-16 03:10:05 -07:00
parent befeedfd37
commit 03690ee354
14 changed files with 472 additions and 52 deletions
+6
View File
@@ -255,6 +255,12 @@ export async function migrateSchema(pool) {
`ALTER TABLE h5_payment_orders
MODIFY pay_mode ENUM('native', 'h5', 'jsapi') NOT NULL DEFAULT 'native'`,
);
if (!(await indexExists(pool, 'h5_usage_records', 'idx_h5_usage_created'))) {
await pool.query(
`ALTER TABLE h5_usage_records ADD KEY idx_h5_usage_created (created_at)`,
);
}
}
export async function initSchema(pool) {