diff --git a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java index 44752f4..09fd7c0 100644 --- a/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/discount/impl/BsDiscountUserServiceImpl.java @@ -331,6 +331,9 @@ public class BsDiscountUserServiceImpl implements BsDiscountUserService { if (!giveUser.getId().equals(discountUser.getUserId())) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券无法赠送"); } + if (giveUser.getPhone().equals(phone)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "不可以赠送给自己"); + } // 查询接收人 BsUser user = userService.getUser(phone); if (user == null) {