transfer 不能转账给自己

This commit is contained in:
tianfeng 2025-11-04 11:58:26 +08:00
parent ef0be488c3
commit d40c1055a1
3 changed files with 7 additions and 0 deletions

View File

@ -81,6 +81,11 @@ public enum WalletErrorCode implements IResponseErrorCode {
* 目标用户不是充值代理
*/
TARGET_USER_NOT_RECHARGE_AGENCY(5013, "The target user is not a recharge agency."),
/**
* 不能转账给自己
*/
NOT_TRANSFER_YOURSELF(5014, "You can't transfer money to yourself."),
;

View File

@ -74,6 +74,7 @@ public class LotteryTransferExe {
// 6. 判断接收用户是否是货运代理
boolean isFreight = freightBalanceClient.existsBalance(cmd.getAcceptUserId()).getBody();
ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, isFreight);
ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, !Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId()));
// 1. 获取可提现金额
LotteryWithdrawAmountCO withdrawAmount = lotteryWithdrawAmountQryExe.execute(userId, cmd.getActivityId());;

View File

@ -77,6 +77,7 @@ public class UserBankTransferGoldCmdExe {
boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId());
ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, freight);
ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, !Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId()));
// 上锁
String key = "UBWTransferGold:" + cmd.requiredReqUserId();