checkpoint before checking out feature/account-managed-gateway

This commit is contained in:
Rocky
2026-08-19 15:53:08 +08:00
parent 25cfbfa4e6
commit 1737106560
51 changed files with 1837 additions and 52 deletions
Binary file not shown.
Binary file not shown.
+7 -2
View File
@@ -49,9 +49,14 @@ app:
revokeUrl: "$APPLE_REVOKE_URL:https://appleid.apple.com/auth/revoke"
credits:
signupTrial: "$SIGNUP_TRIAL_CREDITS:1000"
referralInviter: "$REFERRAL_INVITER_CREDITS:3000"
referralInvitee: "$REFERRAL_INVITEE_CREDITS:3000"
referralInviter: "$REFERRAL_INVITER_CREDITS:1000"
referralInvitee: "$REFERRAL_INVITEE_CREDITS:1000"
referralBindingDays: "$REFERRAL_BINDING_DAYS:7"
storeKit:
enabled: "$STOREKIT_ENABLED:false"
bundleId: "$STOREKIT_BUNDLE_ID:com.osgkeyboard.ios"
appAppleId: "$STOREKIT_APP_APPLE_ID:"
products: "$STOREKIT_PRODUCTS:"
providers:
volcengine:
endpoint: "$VOLCENGINE_ASR_ENDPOINT:wss://openspeech.bytedance.com/api/v3/sauc/bigmodel"
@@ -0,0 +1,60 @@
-- Close the initial immutable rates and activate the smaller credit unit.
-- ASR bills one credit per started three-second interval.
-- DeepSeek bills input/output dimensions independently and rounds each upward.
SET @new_credit_rate_effective_from = UTC_TIMESTAMP(6);
UPDATE credit_rate_versions
SET effective_until = @new_credit_rate_effective_from
WHERE id IN (
'10000000-0000-0000-0000-000000000001',
'10000000-0000-0000-0000-000000000002'
)
AND effective_until IS NULL;
INSERT INTO credit_rate_versions (
id,
kind,
provider,
model,
effective_from,
effective_until,
asr_credits_numerator,
asr_millis_denominator,
created_at
) VALUES (
'10000000-0000-0000-0000-000000000003',
'ASR',
'volcengine-sauc-v3',
'volc.seedasr.sauc.duration',
@new_credit_rate_effective_from,
NULL,
1,
3000,
@new_credit_rate_effective_from
);
INSERT INTO credit_rate_versions (
id,
kind,
provider,
model,
effective_from,
effective_until,
input_credits_numerator,
input_tokens_denominator,
output_credits_numerator,
output_tokens_denominator,
created_at
) VALUES (
'10000000-0000-0000-0000-000000000004',
'LLM',
'deepseek',
'deepseek-v4-flash',
@new_credit_rate_effective_from,
NULL,
1,
1000,
1,
400,
@new_credit_rate_effective_from
);
@@ -0,0 +1,9 @@
CREATE TABLE account_profiles (
account_id VARCHAR(36) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
encrypted_display_name MEDIUMTEXT NOT NULL,
created_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
updated_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
PRIMARY KEY (account_id),
CONSTRAINT fk_account_profiles_account
FOREIGN KEY (account_id) REFERENCES accounts (id) ON DELETE CASCADE
) ENGINE = InnoDB;
@@ -0,0 +1,4 @@
UPDATE referral_campaigns
SET inviter_reward_credits = 1000,
invitee_reward_credits = 1000
WHERE id = '00000000-0000-0000-0000-000000000001';
@@ -0,0 +1,24 @@
CREATE TABLE storekit_credit_purchases (
id CHAR(36) NOT NULL,
transaction_id VARCHAR(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
original_transaction_id VARCHAR(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
user_id VARCHAR(36) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
app_account_token CHAR(36) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
product_id VARCHAR(128) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
environment VARCHAR(16) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
credits_granted BIGINT NOT NULL,
ledger_entry_id CHAR(36) NOT NULL,
signed_transaction_sha256 CHAR(64) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
purchased_at DATETIME(6) NOT NULL,
signed_at DATETIME(6) NOT NULL,
created_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
PRIMARY KEY (id),
UNIQUE KEY uk_storekit_purchase_transaction (transaction_id),
UNIQUE KEY uk_storekit_purchase_ledger (ledger_entry_id),
INDEX idx_storekit_purchase_user_created (user_id, created_at, id),
CONSTRAINT chk_storekit_purchase_credits CHECK (credits_granted > 0),
CONSTRAINT chk_storekit_purchase_environment
CHECK (environment IN ('SANDBOX', 'PRODUCTION')),
CONSTRAINT fk_storekit_purchase_ledger
FOREIGN KEY (ledger_entry_id) REFERENCES credit_ledger(id)
) ENGINE = InnoDB;