发送动态礼物新增区域限制
This commit is contained in:
parent
8526bff19a
commit
ed7789adda
@ -38,7 +38,13 @@ public enum GiftErrorCode implements IResponseErrorCode {
|
||||
/**
|
||||
* 配置数据未改动.
|
||||
*/
|
||||
GAME_LUCKY_GIFT_PROBABILITY_CONFIG_UPDATE_ERROR(8405,"Configuration data unchanged");
|
||||
GAME_LUCKY_GIFT_PROBABILITY_CONFIG_UPDATE_ERROR(8405,"Configuration data unchanged"),
|
||||
|
||||
/**
|
||||
* 不是同一个大区
|
||||
*/
|
||||
NOT_SAME_REGION(8406, "Not the same region"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
@ -12,6 +12,7 @@ import com.red.circle.other.app.convertor.material.GiftAppConvertor;
|
||||
import com.red.circle.other.app.dto.cmd.gift.GiveAwayGiftBatchCmd;
|
||||
import com.red.circle.other.app.service.task.TaskService;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
|
||||
import com.red.circle.other.infra.database.cache.service.other.GiftCacheService;
|
||||
import com.red.circle.other.inner.asserts.GiftErrorCode;
|
||||
import com.red.circle.other.inner.enums.material.GiftCurrencyType;
|
||||
@ -30,6 +31,7 @@ import com.red.circle.wallet.inner.model.dto.WalletReceiptResDTO;
|
||||
import com.red.circle.wallet.inner.model.enums.GoldOrigin;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -52,6 +54,7 @@ public class GiftGiveAwayBatchCmdExe {
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final WalletDiamondClient walletDiamondClient;
|
||||
private final TaskService taskService;
|
||||
private final UserRegionGateway userRegionGateway;
|
||||
|
||||
public BigDecimal execute(GiveAwayGiftBatchCmd cmd) {
|
||||
|
||||
@ -69,6 +72,9 @@ public class GiftGiveAwayBatchCmdExe {
|
||||
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR,
|
||||
CollectionUtils.isNotEmpty(cmd.filterAcceptUserId()));
|
||||
|
||||
// 动态礼物检查区域
|
||||
checkDynamicRegion(cmd);
|
||||
|
||||
if (giftConfig.getGiftCandy().equals(new BigDecimal("0.00"))) {
|
||||
BigDecimal dollarAmount = walletGoldClient.getBalance(cmd.requiredReqUserId()).getBody().getDollarAmount();
|
||||
log.info("赠送普通礼物金额为0,余额为 {}", dollarAmount);
|
||||
@ -94,6 +100,16 @@ public class GiftGiveAwayBatchCmdExe {
|
||||
return receipt.getBalance();
|
||||
}
|
||||
|
||||
private void checkDynamicRegion(GiveAwayGiftBatchCmd cmd) {
|
||||
if (cmd.getDynamicContentId() == null) {
|
||||
return;
|
||||
}
|
||||
ResponseAssert.isTrue(CommonErrorCode.DATA_ERROR, cmd.getAcceptUserIds() != null && cmd.getAcceptUserIds().size() == 1);
|
||||
Long acceptUserId = cmd.getAcceptUserIds().get(0);
|
||||
|
||||
ResponseAssert.isTrue(GiftErrorCode.NOT_SAME_REGION, userRegionGateway.checkEqRegion(cmd.getReqUserId(), acceptUserId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 付钱.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user