refactor: 清理 YAML 支付配置遗留代码,重命名 Card* 常量为 Asset*,新增支付配置相关错误码

- 删除 PaymentConfig 结构体和 WechatConfig.Payment 字段(YAML 方案已废弃)
- 删除 wechat.payment 配置节和 NewPaymentApp() 函数
- 删除 validateWechatConfig 中所有 wechatCfg.Payment.* 校验代码
- pkg/constants/wallet.go: Card* 前缀统一重命名为 Asset*,旧名保留废弃别名
- pkg/constants/redis.go: 新增 RedisWechatConfigActiveKey()
- pkg/errors/codes.go: 新增错误码 1170-1175
- go.mod: 新增 golang.org/x/text 依赖(富友支付 GBK 编解码)

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 23:28:29 +08:00
parent 7f18765911
commit b0da71bd25
9 changed files with 115 additions and 152 deletions

View File

@@ -47,37 +47,37 @@ const (
AgentRechargeMaxAmount = 100000000 // 最大充值金额1000000元
)
// ========== 钱包常量 ==========
// ========== 资产钱包常量 ==========
// 钱包资源类型
// 资产钱包资源类型
const (
CardWalletResourceTypeIotCard = "iot_card" // 物联网卡钱包
CardWalletResourceTypeDevice = "device" // 设备钱包(多卡共享)
AssetWalletResourceTypeIotCard = "iot_card" // 物联网卡钱包
AssetWalletResourceTypeDevice = "device" // 设备钱包(多卡共享)
)
// 钱包状态
// 资产钱包状态
const (
CardWalletStatusNormal = 1 // 正常
CardWalletStatusFrozen = 2 // 冻结
CardWalletStatusClosed = 3 // 关闭
AssetWalletStatusNormal = 1 // 正常
AssetWalletStatusFrozen = 2 // 冻结
AssetWalletStatusClosed = 3 // 关闭
)
// 钱包交易类型
// 资产钱包交易类型
const (
CardTransactionTypeRecharge = "recharge" // 充值
CardTransactionTypeDeduct = "deduct" // 扣款
CardTransactionTypeRefund = "refund" // 退款
AssetTransactionTypeRecharge = "recharge" // 充值
AssetTransactionTypeDeduct = "deduct" // 扣款
AssetTransactionTypeRefund = "refund" // 退款
)
// 充值订单号前缀
// 资产充值订单号前缀
const (
CardRechargeOrderPrefix = "CRCH" // 充值订单号前缀
AssetRechargeOrderPrefix = "CRCH" // 资产充值订单号前缀
)
// 充值金额限制(单位:分)
// 资产充值金额限制(单位:分)
const (
CardRechargeMinAmount = 100 // 最小充值金额1元
CardRechargeMaxAmount = 10000000 // 最大充值金额100000元
AssetRechargeMinAmount = 100 // 最小充值金额1元
AssetRechargeMaxAmount = 10000000 // 最大充值金额100000元
)
// ========== 通用常量 ==========
@@ -154,31 +154,31 @@ const WalletTypeMain = AgentWalletTypeMain
// WalletTypeCommission 分佣钱包(已废弃,使用 AgentWalletTypeCommission
const WalletTypeCommission = AgentWalletTypeCommission
// WalletResourceTypeIotCard 物联网卡钱包(已废弃,使用 CardWalletResourceTypeIotCard
const WalletResourceTypeIotCard = CardWalletResourceTypeIotCard
// WalletResourceTypeIotCard 物联网卡钱包(已废弃,使用 AssetWalletResourceTypeIotCard
const WalletResourceTypeIotCard = AssetWalletResourceTypeIotCard
// WalletResourceTypeDevice 设备钱包(已废弃,使用 CardWalletResourceTypeDevice
const WalletResourceTypeDevice = CardWalletResourceTypeDevice
// WalletResourceTypeDevice 设备钱包(已废弃,使用 AssetWalletResourceTypeDevice
const WalletResourceTypeDevice = AssetWalletResourceTypeDevice
// WalletResourceTypeShop 店铺钱包(已废弃,代理钱包不再使用 resource_type
const WalletResourceTypeShop = "shop"
// WalletStatusNormal 钱包状态-正常(已废弃,使用 AgentWalletStatusNormal 或 CardWalletStatusNormal
// WalletStatusNormal 钱包状态-正常(已废弃,使用 AgentWalletStatusNormal 或 AssetWalletStatusNormal
const WalletStatusNormal = AgentWalletStatusNormal
// WalletStatusFrozen 钱包状态-冻结(已废弃,使用 AgentWalletStatusFrozen 或 CardWalletStatusFrozen
// WalletStatusFrozen 钱包状态-冻结(已废弃,使用 AgentWalletStatusFrozen 或 AssetWalletStatusFrozen
const WalletStatusFrozen = AgentWalletStatusFrozen
// WalletStatusClosed 钱包状态-关闭(已废弃,使用 AgentWalletStatusClosed 或 CardWalletStatusClosed
// WalletStatusClosed 钱包状态-关闭(已废弃,使用 AgentWalletStatusClosed 或 AssetWalletStatusClosed
const WalletStatusClosed = AgentWalletStatusClosed
// TransactionTypeRecharge 交易类型-充值(已废弃,使用 AgentTransactionTypeRecharge 或 CardTransactionTypeRecharge
// TransactionTypeRecharge 交易类型-充值(已废弃,使用 AgentTransactionTypeRecharge 或 AssetTransactionTypeRecharge
const TransactionTypeRecharge = AgentTransactionTypeRecharge
// TransactionTypeDeduct 交易类型-扣款(已废弃,使用 AgentTransactionTypeDeduct 或 CardTransactionTypeDeduct
// TransactionTypeDeduct 交易类型-扣款(已废弃,使用 AgentTransactionTypeDeduct 或 AssetTransactionTypeDeduct
const TransactionTypeDeduct = AgentTransactionTypeDeduct
// TransactionTypeRefund 交易类型-退款(已废弃,使用 AgentTransactionTypeRefund 或 CardTransactionTypeRefund
// TransactionTypeRefund 交易类型-退款(已废弃,使用 AgentTransactionTypeRefund 或 AssetTransactionTypeRefund
const TransactionTypeRefund = AgentTransactionTypeRefund
// TransactionTypeCommission 交易类型-分佣(已废弃,使用 AgentTransactionTypeCommission
@@ -187,11 +187,46 @@ const TransactionTypeCommission = AgentTransactionTypeCommission
// TransactionTypeWithdrawal 交易类型-提现(已废弃,使用 AgentTransactionTypeWithdrawal
const TransactionTypeWithdrawal = AgentTransactionTypeWithdrawal
// RechargeOrderPrefix 充值订单号前缀(已废弃,使用 AgentRechargeOrderPrefix 或 CardRechargeOrderPrefix
// RechargeOrderPrefix 充值订单号前缀(已废弃,使用 AgentRechargeOrderPrefix 或 AssetRechargeOrderPrefix
const RechargeOrderPrefix = "RCH"
// RechargeMinAmount 最小充值金额(已废弃,使用 AgentRechargeMinAmount 或 CardRechargeMinAmount
const RechargeMinAmount = CardRechargeMinAmount
// RechargeMinAmount 最小充值金额(已废弃,使用 AgentRechargeMinAmount 或 AssetRechargeMinAmount
const RechargeMinAmount = AssetRechargeMinAmount
// RechargeMaxAmount 最大充值金额(已废弃,使用 AgentRechargeMaxAmount 或 CardRechargeMaxAmount
const RechargeMaxAmount = CardRechargeMaxAmount
// RechargeMaxAmount 最大充值金额(已废弃,使用 AgentRechargeMaxAmount 或 AssetRechargeMaxAmount
const RechargeMaxAmount = AssetRechargeMaxAmount
// ========== Card* 废弃别名(向后兼容)==========
// Deprecated: 使用 AssetWalletResourceTypeIotCard
const CardWalletResourceTypeIotCard = AssetWalletResourceTypeIotCard
// Deprecated: 使用 AssetWalletResourceTypeDevice
const CardWalletResourceTypeDevice = AssetWalletResourceTypeDevice
// Deprecated: 使用 AssetWalletStatusNormal
const CardWalletStatusNormal = AssetWalletStatusNormal
// Deprecated: 使用 AssetWalletStatusFrozen
const CardWalletStatusFrozen = AssetWalletStatusFrozen
// Deprecated: 使用 AssetWalletStatusClosed
const CardWalletStatusClosed = AssetWalletStatusClosed
// Deprecated: 使用 AssetTransactionTypeRecharge
const CardTransactionTypeRecharge = AssetTransactionTypeRecharge
// Deprecated: 使用 AssetTransactionTypeDeduct
const CardTransactionTypeDeduct = AssetTransactionTypeDeduct
// Deprecated: 使用 AssetTransactionTypeRefund
const CardTransactionTypeRefund = AssetTransactionTypeRefund
// Deprecated: 使用 AssetRechargeOrderPrefix
const CardRechargeOrderPrefix = AssetRechargeOrderPrefix
// Deprecated: 使用 AssetRechargeMinAmount
const CardRechargeMinAmount = AssetRechargeMinAmount
// Deprecated: 使用 AssetRechargeMaxAmount
const CardRechargeMaxAmount = AssetRechargeMaxAmount