package cn.iocoder.yudao.module.system.api.remote;

import cn.iocoder.yudao.module.system.api.remote.dto.LoginCheckDTO;
import cn.iocoder.yudao.module.system.service.remote.RemoteControllerInformationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class RemoteLoginApiImpl implements RemoteLoginApi{

    @Resource
    private RemoteControllerInformationService controllerInformationService;

    /**
     * 保存IP和端口
     * @param loginCheckDTO
     */
    @Override
    public void saveIpAndPort(LoginCheckDTO loginCheckDTO) {
        controllerInformationService.saveIpAndPort(loginCheckDTO);
    }

    /**
     * 查询远遥默认IP和端口
     * @return
     */
    @Override
    public LoginCheckDTO getIpAndPort(String ip) {
        return controllerInformationService.getDefaultIpAndPort(ip);
    }
}
