角标配置入口-财富等级限制生效范围
This commit is contained in:
@@ -28,6 +28,9 @@ public enum RuleCodeEnum {
|
||||
//用户等级
|
||||
USER_LEVEL,
|
||||
|
||||
//用户等级限制身份,1-全部用户,2非主播身份
|
||||
USER_LEVEL_LIMIT_ROLE,
|
||||
|
||||
//备用字段
|
||||
RESERVE,;
|
||||
|
||||
|
@@ -6,10 +6,12 @@ import com.accompany.business.dto.resource.ResourceContext;
|
||||
import com.accompany.business.enums.resource.ResourceTypeEnum;
|
||||
import com.accompany.business.enums.resource.RuleCodeEnum;
|
||||
import com.accompany.business.model.UserLevelExperience;
|
||||
import com.accompany.business.model.guild.GuildMember;
|
||||
import com.accompany.business.model.resource.Resource;
|
||||
import com.accompany.business.model.resource.ResourceRule;
|
||||
import com.accompany.business.mybatismapper.resource.ResourceMapper;
|
||||
import com.accompany.business.service.fillstrategy.strategy.FillFactory;
|
||||
import com.accompany.business.service.guild.GuildMemberService;
|
||||
import com.accompany.business.service.level.LevelService;
|
||||
import com.accompany.business.service.resource.ResourceRuleService;
|
||||
import com.accompany.business.service.resource.ResourceService;
|
||||
@@ -64,6 +66,9 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
@Autowired
|
||||
private HighRechargeUserService highRechargeUserService;
|
||||
|
||||
@Autowired
|
||||
private GuildMemberService guildMemberService;
|
||||
|
||||
@Override
|
||||
public boolean isOpen(String code) {
|
||||
return getResource(code) != null;
|
||||
@@ -96,6 +101,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
}
|
||||
context.setNotChannels(channel);
|
||||
Integer partitionId = null;
|
||||
GuildMember guildMember = null;
|
||||
if (uid != null) {
|
||||
UserLevelExperience userExperience = levelService.getUserExper(uid);
|
||||
if (userExperience != null && userExperience.getLevelExperience() != null) {
|
||||
@@ -109,6 +115,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
}
|
||||
partitionId = users.getPartitionId();
|
||||
}
|
||||
guildMember = guildMemberService.getVaildGuildMemberByUid(uid);
|
||||
boolean isHighRechargeUser = highRechargeUserService.isHighRechargeUser(uid);
|
||||
context.setHighRechargeUser(isHighRechargeUser? "大R": "普通");
|
||||
}
|
||||
@@ -156,10 +163,13 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
}
|
||||
//动态校验规则
|
||||
JSONObject jsonObject = JSONObject.parseObject(ruleValueJson);
|
||||
boolean limitUserLevel = !(guildMember != null
|
||||
&& jsonObject.containsKey(RuleCodeEnum.USER_LEVEL_LIMIT_ROLE.name())
|
||||
&& "2".equals(jsonObject.getString(RuleCodeEnum.USER_LEVEL_LIMIT_ROLE.name())));
|
||||
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object ruleValue = entry.getValue();
|
||||
if (CollectionUtil.isEmpty(rules)) {
|
||||
if (CollectionUtil.isEmpty(rules) || RuleCodeEnum.USER_LEVEL_LIMIT_ROLE.name().equals(key)) {
|
||||
continue;
|
||||
}
|
||||
if (ruleValue == null || StrUtil.isEmpty(ruleValue.toString())) {
|
||||
@@ -198,11 +208,13 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
isSkip = Integer.parseInt(val1) > Integer.parseInt(val2);
|
||||
}
|
||||
} else if (OperateType.GE.name().equals(kind)) {
|
||||
//版本号
|
||||
if (targetValue.toString().contains(StrUtil.DOT) && !targetValue.toString().startsWith(StrUtil.DELIM_START) && !targetValue.toString().startsWith(StrUtil.DELIM_END)){
|
||||
isSkip = AppVersionUtil.compareVersion(val1, val2) < 0;
|
||||
} else {
|
||||
isSkip = Integer.parseInt(val1) < Integer.parseInt(val2);
|
||||
limitUserLevel = RuleCodeEnum.USER_LEVEL.name().equals(key) && limitUserLevel;
|
||||
if (!limitUserLevel) {
|
||||
if (targetValue.toString().contains(StrUtil.DOT) && !targetValue.toString().startsWith(StrUtil.DELIM_START) && !targetValue.toString().startsWith(StrUtil.DELIM_END)){
|
||||
isSkip = AppVersionUtil.compareVersion(val1, val2) < 0;
|
||||
} else {
|
||||
isSkip = Integer.parseInt(val1) < Integer.parseInt(val2);
|
||||
}
|
||||
}
|
||||
} else if (OperateType.LEFT_LIKE.name().equals(kind)) {
|
||||
if (StrUtil.isNotEmpty(val1) && StrUtil.isNotEmpty(description) && val2.equals(YES_ZH)) {
|
||||
|
Reference in New Issue
Block a user