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();
    }
}
