From 5031bf15b9ec003dfeca778d2a0c99088014c6f8 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 16 Mar 2026 15:43:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=20wallet=20?= =?UTF-8?q?=E5=B8=B8=E9=87=8F=E5=92=8C=E9=98=9F=E5=88=97=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=BB=A5=E9=80=82=E9=85=8D=20asset=5Fwallet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- pkg/constants/wallet.go | 16 ++++++++-------- pkg/queue/types.go | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pkg/constants/wallet.go b/pkg/constants/wallet.go index 55831df..5f007ac 100644 --- a/pkg/constants/wallet.go +++ b/pkg/constants/wallet.go @@ -130,18 +130,18 @@ func RedisAgentWalletLockKey(shopID uint, walletType string) string { return fmt.Sprintf("agent_wallet:lock:%d:%s", shopID, walletType) } -// RedisCardWalletBalanceKey 卡钱包余额缓存 Key -// 格式:card_wallet:balance:{resource_type}:{resource_id} +// RedisAssetWalletBalanceKey 资产钱包余额缓存 Key +// 格式:asset_wallet:balance:{resource_type}:{resource_id} // TTL:180 秒(3 分钟) -func RedisCardWalletBalanceKey(resourceType string, resourceID uint) string { - return fmt.Sprintf("card_wallet:balance:%s:%d", resourceType, resourceID) +func RedisAssetWalletBalanceKey(resourceType string, resourceID uint) string { + return fmt.Sprintf("asset_wallet:balance:%s:%d", resourceType, resourceID) } -// RedisCardWalletLockKey 卡钱包分布式锁 Key -// 格式:card_wallet:lock:{resource_type}:{resource_id} +// RedisAssetWalletLockKey 资产钱包分布式锁 Key +// 格式:asset_wallet:lock:{resource_type}:{resource_id} // TTL:10 秒 -func RedisCardWalletLockKey(resourceType string, resourceID uint) string { - return fmt.Sprintf("card_wallet:lock:%s:%d", resourceType, resourceID) +func RedisAssetWalletLockKey(resourceType string, resourceID uint) string { + return fmt.Sprintf("asset_wallet:lock:%s:%d", resourceType, resourceID) } // ========== 兼容性别名(待清理)========== diff --git a/pkg/queue/types.go b/pkg/queue/types.go index 29cbb8b..ef39005 100644 --- a/pkg/queue/types.go +++ b/pkg/queue/types.go @@ -39,10 +39,9 @@ type WorkerStores struct { PollingAlertHistory *postgres.PollingAlertHistoryStore DataCleanupConfig *postgres.DataCleanupConfigStore DataCleanupLog *postgres.DataCleanupLogStore - // 新增代理钱包 Store - AgentWallet *postgres.AgentWalletStore - AgentWalletTransaction *postgres.AgentWalletTransactionStore - CardWallet *postgres.CardWalletStore // 卡钱包 Store(用于订单取消时解冻) + AgentWallet *postgres.AgentWalletStore + AgentWalletTransaction *postgres.AgentWalletTransactionStore + AssetWallet *postgres.AssetWalletStore } // WorkerServices Worker 侧所有 Service 的集合