package com.ruoyi.interfaces.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.OkHttpUtils;
import com.ruoyi.interfaces.domain.GatewayRoutes;
import com.ruoyi.interfaces.mapper.GatewayRoutesMapper;
import com.ruoyi.interfaces.service.GatewayRoutesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class GatewayRoutesServiceImpl extends ServiceImpl<GatewayRoutesMapper, GatewayRoutes> implements GatewayRoutesService {

    @Value("${sys.gateway.url}")
    private String gatewayUrl;

    @Async
    public void refreshRoutes() {
        OkHttpUtils.get(gatewayUrl + "/gateway/refresh");
        log.info("刷新路由");
    }

}
