消息类型处理

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);
}
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.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,13 +94,15 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi {
url = props.getCover();
}
if (Objects.isNull(user)) {
return ResultResponse.success();
}
Map<String, Object> map = new HashMap<>();
map.put("propType", type);
if (!Objects.isNull(user)) {
if (Arrays.asList("ACTIVITY", "ADMINISTRATOR").contains(type)) {
if (BadgeConfigTypeEnum.of(type)) {
BadgePictureConfig badgePictureConfig = badgePictureConfigService.getByBadgeId(user.getOriginSys(), propsId);
url = badgePictureConfig != null ? badgePictureConfig.getSelectUrl() : "";
map.put("propType", "BADGE");
}
RegionConfig region = userRegionGateway.getRegionConfigByUserId(userId);
@ -110,7 +113,8 @@ public class PropsBackpackClientEndpoint implements PropsBackpackClientApi {
.content(I18nUtils.getPropsRewardContent(type, days, I18nUtils.getLanguageByRegion(region.getRegionName())))
.expand(url)
.build());
}
return ResultResponse.success();
}