卡只允许支付宝支付,设备只允许微信支付,钱包充值也遵循这个规则
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m53s

This commit is contained in:
2026-07-03 10:26:48 +09:00
parent 0d79130e07
commit 346156ee9b
2 changed files with 38 additions and 0 deletions

View File

@@ -279,6 +279,18 @@ func (h *ClientWalletHandler) CreateRecharge(c *fiber.Ctx) error {
return err
}
// 第三方支付方式与资产类型必须匹配:单卡只允许支付宝,设备只允许微信
switch resolved.Asset.AssetType {
case "card":
if req.PaymentMethod != constants.RechargeMethodAlipay {
return errors.New(errors.CodeInvalidParam, "单卡资产只支持支付宝充值")
}
case "device":
if req.PaymentMethod != constants.RechargeMethodWechat {
return errors.New(errors.CodeInvalidParam, "设备资产只支持微信充值")
}
}
config, err := h.wechatConfigService.GetActiveConfig(resolved.SkipPermissionCtx)
if err != nil {
return err