发红包不扣除手续费, 领红包扣除手续费

This commit is contained in:
tianfeng 2026-01-14 14:25:53 +08:00
parent 08dcf14388
commit 3ba78182c1
2 changed files with 7 additions and 4 deletions

View File

@ -68,6 +68,8 @@ public class GrabUserRedPacketCmdExe {
ResponseAssert.isTrue(OtherErrorCode.RED_PACKET_ALREADY_GRABBED, UserRedPacketStatus.PENDING.getCode().equals(status));
Long amount = Long.valueOf(String.valueOf(packetData.get("totalAmount")));
Long handlingFee = Long.valueOf(String.valueOf(packetData.get("handlingFee")));
Long receiveAmount = amount - handlingFee;
Long senderUserId = Long.valueOf(String.valueOf(packetData.get("senderUserId")));
long expireSeconds = Math.max(60, Duration.between(LocalDateTime.now(), expireTime).getSeconds());
@ -75,12 +77,12 @@ public class GrabUserRedPacketCmdExe {
ResponseAssert.isTrue(OtherErrorCode.RED_PACKET_ALREADY_GRABBED, setSuccess);
CompletableFuture.runAsync(() -> {
asyncProcessGrab(packetId, cmd.getReqSysOrigin().getOrigin(), userId, amount);
asyncProcessGrab(packetId, cmd.getReqSysOrigin().getOrigin(), userId, receiveAmount);
}, redPacketAsyncExecutor);
log.info("领取用户红包成功 userId={} packetId={} amount={}", userId, packetId, amount);
log.info("领取用户红包成功 userId={} packetId={} amount={}", userId, packetId, receiveAmount);
return UserRedPacketAppConvertor.toGrabResultCO(packetId, amount, senderUserId);
return UserRedPacketAppConvertor.toGrabResultCO(packetId, receiveAmount, senderUserId);
}
/**

View File

@ -91,7 +91,8 @@ public class SendUserRedPacketCmdExe {
* 扣除用户金币红包金额 + 手续费
*/
private void deductUserGold(Long userId, SendUserRedPacketCmd cmd, String packetId, Long handlingFee) {
Long totalDeduct = cmd.getTotalAmount() + handlingFee;
// 发红包不再扣除手续费
Long totalDeduct = cmd.getTotalAmount();
GoldReceiptCmd build = GoldReceiptCmd.builder()
.appExpenditure()