This commit is contained in:
张良(004796)
2024-02-05 15:46:29 +08:00
parent 144c5d1335
commit caac9f5cc1
14 changed files with 176 additions and 80 deletions

View File

@@ -12,12 +12,12 @@ import lombok.Setter;
* @author ZL
*/
public enum SystemConfigEnum {
RANK_LOVE_DAY_AWARD("138,108,88,58,38,28,28,28,28,28,28", "魅力榜日榜奖励", SystemConfigGroupEnum.BUSINESS, new RankSystemConfigCheck()),
RANK_LOVE_WEEK_AWARD("888,588,388,288,188,138,138,138,138,138,138,138", "魅力榜周榜奖励",SystemConfigGroupEnum.BUSINESS, new RankSystemConfigCheck()),
RANK_INVITE_DAY_AWARD("138,108,88,58,38,28,28,28,28,28,28", "邀请榜日榜奖励",SystemConfigGroupEnum.BUSINESS,new RankSystemConfigCheck()),
RANK_INVITE_WEEK_AWARD("888,588,388,288,188,138,138,138,138,138,138,138", "邀请榜周榜奖励",SystemConfigGroupEnum.BUSINESS,new RankSystemConfigCheck()),
INVITE_BIND_RATE("1000", "邀请绑定成功率[0-1000]数字越大成功率越高",SystemConfigGroupEnum.BUSINESS, new Rate1000IntegerSystemConfigCheck()),
SHARE_URL("https://h5.qx96688.com/index/invite/index", "分享链接",SystemConfigGroupEnum.BUSINESS, new Rate1000IntegerSystemConfigCheck()),
RANK_LOVE_DAY_AWARD("138,108,88,58,38,28,28,28,28,28,28", "魅力榜日榜前10名奖励", SystemConfigGroupEnum.BUSINESS, new NumberListSystemConfigCheck(10)),
RANK_LOVE_WEEK_AWARD("888,588,388,288,188,138,138,138,138,138,138,138", "魅力榜周榜前10名奖励",SystemConfigGroupEnum.BUSINESS, new NumberListSystemConfigCheck(10)),
RANK_INVITE_DAY_AWARD("138,108,88,58,38,28,28,28,28,28,28", "邀请榜日榜前10名奖励",SystemConfigGroupEnum.BUSINESS,new NumberListSystemConfigCheck(10)),
RANK_INVITE_WEEK_AWARD("888,588,388,288,188,138,138,138,138,138,138,138", "邀请榜周榜前10名奖励",SystemConfigGroupEnum.BUSINESS,new NumberListSystemConfigCheck(10)),
INVITE_BIND_RATE("1000", "邀请绑定成功率[0-1000]数字越大成功率越高",SystemConfigGroupEnum.BUSINESS, new RangeIntegerSystemConfigCheck(0,1000)),
SHARE_URL("https://h5.qx96688.com/index/invite/index", "分享链接",SystemConfigGroupEnum.BUSINESS),
// INVITE_GIFT_RATE("100", "礼物分销成功率",SystemConfigGroupEnum.BUSINESS, new RateIntegerSystemConfigCheck()),
// INVITE_GUARD_RATE("100", "守护分销成功率",SystemConfigGroupEnum.BUSINESS, new RateIntegerSystemConfigCheck()),
// INVITE_VIDEO_RATE("100", "视频分销成功率",SystemConfigGroupEnum.BUSINESS, new RateIntegerSystemConfigCheck()),
@@ -30,7 +30,7 @@ public enum SystemConfigEnum {
GUARD_PRICE("1314", "守护价格",SystemConfigGroupEnum.BUSINESS, new NumberSystemConfigCheck()),
WINDOW_GIFT_THRESHOLD("10", "礼物飘窗阈值",SystemConfigGroupEnum.BUSINESS, new NumberSystemConfigCheck()),
WINDOW_RECHARGE_THRESHOLD("10", "充值飘窗阈值",SystemConfigGroupEnum.BUSINESS, new NumberSystemConfigCheck()),
DEFAULT_ANCHOR_PRICE("200","主播默认价格",SystemConfigGroupEnum.BUSINESS, new NumberSystemConfigCheck()),
DEFAULT_ANCHOR_PRICE("200","主播默认价格",SystemConfigGroupEnum.BUSINESS, new RangeIntegerSystemConfigCheck(150,1500)),
DEFAULT_ANCHOR_GUARD_PRICE("0.5","主播默认守护提成",SystemConfigGroupEnum.BUSINESS,new RateSystemConfigCheck()),
DEFAULT_ANCHOR_GIFT_PRICE("0.5","主播默认礼物提成",SystemConfigGroupEnum.BUSINESS,new RateSystemConfigCheck()),
DEFAULT_ANCHOR_VIDEO_PRICE("0.5","主播默认视频提成",SystemConfigGroupEnum.BUSINESS,new RateSystemConfigCheck()),
@@ -51,7 +51,8 @@ public enum SystemConfigEnum {
ALI_PAY_FIRST("1", "支付宝支付显示是否在前面",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
OPEN_WITHDRAW("1", "是否开启提现功能",SystemConfigGroupEnum.BUSINESS,new BooleanSystemConfigCheck()),
HOME_RECOMMEND_FOLLOWS_LIMIT("20", "首页随机推荐关注用户数量",SystemConfigGroupEnum.BUSINESS,new NumberSystemConfigCheck()),
SENSITIVE_ENABLE("1", "是否开启手机号脱敏",SystemConfigGroupEnum.SYSTEM),
SENSITIVE_ENABLE("1", "是否开启手机号脱敏",SystemConfigGroupEnum.SYSTEM,new BooleanSystemConfigCheck()),
YUNXIN_ONLINE_ENABLE("1", "是否开启云信监控在线状态",SystemConfigGroupEnum.SYSTEM,new BooleanSystemConfigCheck()),
SMS_CODE_ADMIN("", "万能验证码",SystemConfigGroupEnum.SYSTEM),
PASSWORD_ADMIN("", "公用密码",SystemConfigGroupEnum.SYSTEM),
COS_DOMAIN("http://nono-1257812345.cos.ap-shanghai.myqcloud.com/", "文件系统域名前缀",SystemConfigGroupEnum.SYSTEM),

View File

@@ -0,0 +1,34 @@
package com.ruoyi.cai.enums.systemconfig;
import com.ruoyi.common.utils.StringUtils;
import lombok.Getter;
import java.util.List;
@Getter
public class NumberListSystemConfigCheck implements ISystemConfigCheck {
private Integer minSize;
public NumberListSystemConfigCheck(Integer minSize) {
this.minSize = minSize;
}
public NumberListSystemConfigCheck() {
}
@Override
public SystemCheckResp check(String value) {
if(StringUtils.isEmpty(value)){
return SystemCheckResp.fail("该配置必填");
}
String errMessage = String.format("请填写逗号分割的数字,且需要不低于%s个", minSize);
List<Long> longList = SystemConfigCheckUtil.getArrayListOfLong(value);
if(longList == null){
return SystemCheckResp.fail(errMessage);
}
if(longList.size() < minSize){
return SystemCheckResp.fail(errMessage);
}
return SystemCheckResp.ok();
}
}

View File

@@ -0,0 +1,34 @@
package com.ruoyi.cai.enums.systemconfig;
import cn.hutool.core.util.NumberUtil;
import com.ruoyi.common.utils.StringUtils;
import lombok.Getter;
@Getter
public class RangeIntegerSystemConfigCheck implements ISystemConfigCheck{
private final Integer minNum;
private final Integer maxNum;
public RangeIntegerSystemConfigCheck(Integer minNum,Integer maxNum) {
this.minNum = minNum;
this.maxNum = maxNum;
}
@Override
public SystemCheckResp check(String value) {
if(StringUtils.isEmpty(value)){
return SystemCheckResp.fail("该配置必填");
}
String errorNum = String.format("请填写正确的整数,范围[%s,%s]", minNum, maxNum);
boolean b = NumberUtil.isLong(value);
if(!b){
return SystemCheckResp.fail(errorNum);
}
int of = Integer.parseInt(value);
if(of < minNum || of > maxNum){
return SystemCheckResp.fail(errorNum);
}
return SystemCheckResp.ok();
}
}

View File

@@ -1,17 +0,0 @@
package com.ruoyi.cai.enums.systemconfig;
import com.ruoyi.common.utils.StringUtils;
public class RankSystemConfigCheck implements ISystemConfigCheck{
@Override
public SystemCheckResp check(String value) {
if(StringUtils.isEmpty(value)){
return SystemCheckResp.fail("该配置必填");
}
boolean b = SystemConfigCheckUtil.checkArrayListLong(value, 10);
if(!b){
return SystemCheckResp.fail("请填写逗号分割的数字且需要超过10个!");
}
return SystemCheckResp.ok();
}
}

View File

@@ -1,23 +0,0 @@
package com.ruoyi.cai.enums.systemconfig;
import cn.hutool.core.util.NumberUtil;
import com.ruoyi.common.utils.StringUtils;
public class Rate1000IntegerSystemConfigCheck implements ISystemConfigCheck{
@Override
public SystemCheckResp check(String value) {
if(StringUtils.isEmpty(value)){
return SystemCheckResp.fail("该配置必填");
}
boolean b = NumberUtil.isInteger(value);
if(!b){
return SystemCheckResp.fail("请填写[0-1000]之间的整数");
}
int val = Integer.parseInt(value);
if(val < 0 || val > 1000){
return SystemCheckResp.fail("请填写[0-1000]之间的整数");
}
return SystemCheckResp.ok();
}
}

View File

@@ -1,22 +0,0 @@
package com.ruoyi.cai.enums.systemconfig;
import cn.hutool.core.util.NumberUtil;
import com.ruoyi.common.utils.StringUtils;
public class Rate100IntegerSystemConfigCheck implements ISystemConfigCheck{
@Override
public SystemCheckResp check(String value) {
if(StringUtils.isEmpty(value)){
return SystemCheckResp.fail("该配置必填");
}
boolean b = NumberUtil.isInteger(value);
if(!b){
return SystemCheckResp.fail("请填写[0-100]之间的整数");
}
int val = Integer.parseInt(value);
if(val < 0 || val > 100){
return SystemCheckResp.fail("请填写[0-100]之间的整数");
}
return SystemCheckResp.ok();
}
}

View File

@@ -1,7 +1,24 @@
package com.ruoyi.cai.enums.systemconfig;
import java.util.ArrayList;
import java.util.List;
public class SystemConfigCheckUtil {
public static List<Long> getArrayListOfLong(String value){
try {
String[] split = value.split(",");
List<Long> res = new ArrayList<>();
for (String s : split) {
res.add(Long.valueOf(s));
}
return res;
}catch (Exception e){
return null;
}
}
public static boolean checkArrayListLong(String value, int limit){
try {
String[] split = value.split(",");