feat(billing): record subscription-covered token usage in usage records
Memind CI / Test, build, and release guards (pull_request) Successful in 4m8s

Write h5_usage_records when plan quota fully covers a session bill so
WeChat and H5 consumption stays visible in admin usage history.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-06 18:51:11 +08:00
parent 7c18c998bd
commit 6b586e0951
4 changed files with 145 additions and 6 deletions
+1
View File
@@ -511,6 +511,7 @@ CREATE TABLE IF NOT EXISTS h5_usage_records (
output_tokens INT NOT NULL DEFAULT 0,
cost_cents BIGINT NOT NULL,
balance_after_cents BIGINT NOT NULL,
billing_source VARCHAR(16) NOT NULL DEFAULT 'wallet',
created_at BIGINT NOT NULL,
UNIQUE KEY uniq_h5_usage_request_id (request_id),
KEY idx_h5_usage_user_time (user_id, created_at),