package com.tax.user.service.rules.support;

import com.tax.user.service.api.SysRuleIpService;
import com.tax.user.service.rules.RuleCheckI;
import com.tax.user.utils.RuleUtils;
import com.yxcheng.token.common.enumutil.ResultEnum;
import com.yxcheng.token.common.model.JsonResult;
import com.yxcheng.token.common.model.RuleModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CheckIpInWhiteService implements RuleCheckI {
    @Autowired
    private SysRuleIpService sysRuleIpService;


    @Override
    public boolean check(RuleModel model, JsonResult result) {
        if(!RuleUtils.checkIps(model)){
            return result.errorResponse(ResultEnum.ip_notin_whitelist).isSuccess();
        }
        return true;
    }
}
