refactor: 更新 wallet 常量和队列类型以适配 asset_wallet

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-16 15:43:22 +08:00
parent 9c768e0719
commit 5031bf15b9
2 changed files with 11 additions and 12 deletions

View File

@@ -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}
// TTL180 秒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}
// TTL10 秒
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)
}
// ========== 兼容性别名(待清理)==========

View File

@@ -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用于订单取消时解冻
AssetWallet *postgres.AssetWalletStore
}
// WorkerServices Worker 侧所有 Service 的集合