发送道具券 新增阿语区翻译
This commit is contained in:
parent
74e0aa45bf
commit
97c84fc975
@ -5,7 +5,9 @@ import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExt
|
|||||||
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
|
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
|
||||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||||
|
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
|
||||||
import com.red.circle.other.domain.model.user.UserProfile;
|
import com.red.circle.other.domain.model.user.UserProfile;
|
||||||
|
import com.red.circle.other.domain.model.user.ability.RegionConfig;
|
||||||
import com.red.circle.other.inner.model.cmd.material.PropCouponGrantCmd;
|
import com.red.circle.other.inner.model.cmd.material.PropCouponGrantCmd;
|
||||||
import com.red.circle.other.domain.gateway.PropCouponGateway;
|
import com.red.circle.other.domain.gateway.PropCouponGateway;
|
||||||
import com.red.circle.other.domain.propcoupon.PropCoupon;
|
import com.red.circle.other.domain.propcoupon.PropCoupon;
|
||||||
@ -20,6 +22,7 @@ import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
|||||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@ -42,6 +45,7 @@ public class PropCouponGrantCmdExe {
|
|||||||
private final OfficialNoticeClient officialNoticeClient;
|
private final OfficialNoticeClient officialNoticeClient;
|
||||||
private final PropsSourceClient propsSourceClient;
|
private final PropsSourceClient propsSourceClient;
|
||||||
private final UserProfileGateway userProfileGateway;
|
private final UserProfileGateway userProfileGateway;
|
||||||
|
private final UserRegionGateway userRegionGateway;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行后台赠送道具券
|
* 执行后台赠送道具券
|
||||||
@ -209,15 +213,26 @@ public class PropCouponGrantCmdExe {
|
|||||||
* 发送单个通知
|
* 发送单个通知
|
||||||
*/
|
*/
|
||||||
private void sendNotification(PropCoupon propCoupon, UserProfile user, PropCouponType couponType) {
|
private void sendNotification(PropCoupon propCoupon, UserProfile user, PropCouponType couponType) {
|
||||||
|
String content = getRegionContent(user.getId());
|
||||||
officialNoticeClient.send(
|
officialNoticeClient.send(
|
||||||
NoticeExtTemplateCustomizeCmd.builder()
|
NoticeExtTemplateCustomizeCmd.builder()
|
||||||
.toAccount(user.getId())
|
.toAccount(user.getId())
|
||||||
.noticeType(OfficialNoticeTypeEnum.RECEIVE_PROP_COUPON)
|
.noticeType(OfficialNoticeTypeEnum.RECEIVE_PROP_COUPON)
|
||||||
.content("You have received a Coupon. Please check it.")
|
.content(content)
|
||||||
.build()
|
.build()
|
||||||
);
|
);
|
||||||
|
|
||||||
log.info("发送道具券赠送通知, receiverId:{}, couponNo:{}, couponType:{}",
|
log.info("发送道具券赠送通知, receiverId:{}, couponNo:{}, couponType:{}",
|
||||||
user.getId(), propCoupon.getCouponNo(), propCoupon.getCouponType().getDesc());
|
user.getId(), propCoupon.getCouponNo(), propCoupon.getCouponType().getDesc());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getRegionContent(Long userId) {
|
||||||
|
RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId);
|
||||||
|
boolean arRegion = region != null && "AR".equals(region.getRegionCode());
|
||||||
|
if (arRegion) {
|
||||||
|
return "لقد تلقيت قسيمة. يرجى التحقق منها.";
|
||||||
|
} else {
|
||||||
|
return "You have received a Coupon. Please check it.";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user