package com.dcsoft.system.api.factory;

import com.dcsoft.common.core.domain.R;
import com.dcsoft.system.api.RemoteAuthService;
import com.dcsoft.system.api.domain.SysAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 日志服务降级处理
 *
 * @author dcsoft
 */
@Component
public class RemoteAuthFallbackFactory implements FallbackFactory<RemoteAuthService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteAuthFallbackFactory.class);

    @Override
    public RemoteAuthService create(Throwable throwable)
    {
        log.error("认证服务调用失败:{}", throwable.getMessage());
        return new RemoteAuthService()
        {
            @Override
            public R<SysAuth> getAuth(String id, String source)
            {
                return null;
            }


        };

    }
}
