消息类型处理

This commit is contained in:
tianfeng 2025-11-19 19:58:40 +08:00
parent aa3b880427
commit 8848c93ab4
2 changed files with 33 additions and 16 deletions

View File

@ -48,4 +48,17 @@ public enum BadgeConfigTypeEnum {
return Objects.equals(this.name(), name); 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;
}
} }

View File

@ -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.UserProfile;
import com.red.circle.other.domain.model.user.ability.RegionConfig; 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.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.enums.material.PropsCommodityType;
import com.red.circle.other.inner.model.cmd.material.DeletePropsCmd; import com.red.circle.other.inner.model.cmd.material.DeletePropsCmd;
import com.red.circle.other.inner.model.cmd.material.GivePropsBackpackCmd; import com.red.circle.other.inner.model.cmd.material.GivePropsBackpackCmd;
@ -93,24 +94,27 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi {
url = props.getCover(); url = props.getCover();
} }
Map<String, Object> map = new HashMap<>(); if (Objects.isNull(user)) {
map.put("propType", type); return ResultResponse.success();
if (!Objects.isNull(user)) { }
if (Arrays.asList("ACTIVITY", "ADMINISTRATOR").contains(type)) {
BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(user.getOriginSys(), propsId); Map<String, Object> map = new HashMap<>();
url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : ""; map.put("propType", type);
map.put("propType", "BADGE"); if (BadgeConfigTypeEnum.of(type)) {
BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(user.getOriginSys(), propsId);
url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : "";
} }
RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId); RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId);
officialNoticeClient.send( officialNoticeClient.send(
NoticeExtTemplateCustomizeCmd.builder().toAccount(userId) NoticeExtTemplateCustomizeCmd.builder().toAccount(userId)
.noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS) .noticeType(OfficialNoticeTypeEnum.GIVE_AWAY_PROPS)
.title(JSON.toJSONString(map)) .title(JSON.toJSONString(map))
.content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName()))) .content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName())))
.expand(url) .expand(url)
.build()); .build());
}
return ResultResponse.success(); return ResultResponse.success();
} }