From 8848c93ab461d2b89876aad4e576c6e4d111709b Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Wed, 19 Nov 2025 19:58:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=B1=BB=E5=9E=8B=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enums/material/BadgeConfigTypeEnum.java | 13 +++++++ .../props/PropsBackpackClientEndpoint.java | 36 ++++++++++--------- 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/material/BadgeConfigTypeEnum.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/material/BadgeConfigTypeEnum.java index c528df8f..86f04d34 100644 --- a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/material/BadgeConfigTypeEnum.java +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/enums/material/BadgeConfigTypeEnum.java @@ -48,4 +48,17 @@ public enum BadgeConfigTypeEnum { return Objects.equals(this.name(), name); } + public static boolean isHonorType(String name) { + return name != null && name.startsWith("HONOR"); + } + + public static boolean of(String name) { + for (BadgeConfigTypeEnum value : values()) { + if (value.name().equals(name)) { + return true; + } + } + return false; + } + } diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java index 7ab2d79c..89ae941a 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/endpoint/material/props/PropsBackpackClientEndpoint.java @@ -16,6 +16,7 @@ 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.ability.RegionConfig; import com.red.circle.other.inner.endpoint.material.props.api.PropsBackpackClientApi; +import com.red.circle.other.inner.enums.material.BadgeConfigTypeEnum; import com.red.circle.other.inner.enums.material.PropsCommodityType; import com.red.circle.other.inner.model.cmd.material.DeletePropsCmd; import com.red.circle.other.inner.model.cmd.material.GivePropsBackpackCmd; @@ -93,24 +94,27 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi { url = props.getCover(); } - Map map = new HashMap<>(); - map.put("propType", type); - if (!Objects.isNull(user)) { - if (Arrays.asList("ACTIVITY", "ADMINISTRATOR").contains(type)) { - BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(user.getOriginSys(), propsId); - url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : ""; - map.put("propType", "BADGE"); + if (Objects.isNull(user)) { + return ResultResponse.success(); + } + + Map map = new HashMap<>(); + map.put("propType", type); + if (BadgeConfigTypeEnum.of(type)) { + BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(user.getOriginSys(), propsId); + url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : ""; } - RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId); - officialNoticeClient.send( - NoticeExtTemplateCustomizeCmd.builder().toAccount(userId) - .noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS) - .title(JSON.toJSONString(map)) - .content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName()))) - .expand(url) - .build()); - } + RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId); + officialNoticeClient.send( + NoticeExtTemplateCustomizeCmd.builder().toAccount(userId) + .noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS) + .title(JSON.toJSONString(map)) + .content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName()))) + .expand(url) + .build()); + + return ResultResponse.success(); }