package com.xhpc.common.api.factory;

import com.xhpc.common.api.InternetUserService;
import com.xhpc.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author yuyang
 * @date 2021/11/4 11:49
 * @Version 1.0
 */
@Component
public class InternetUserFallbackFactory implements FallbackFactory<InternetUserService> {

    private static final Logger logger = LoggerFactory.getLogger(InternetUserFallbackFactory.class);
    @Override
    public InternetUserService create(Throwable cause) {
        logger.error("平台第三方服务调用失败:{} //fallback", cause.getMessage());

        return new InternetUserService() {
            @Override
            public R getOperatorIdEvcs(String operatorIdEvcs) {

                return R.fail(3886,"平台第三方服务发送失败:" + cause.getMessage());
            }
        };
    }

}
