package com.yida.data.system.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.EduYidaApp;
import com.yida.data.system.feign.RemoteYidaAppService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteYidaAppService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteYidaAppServiceFallback implements FallbackFactory<RemoteYidaAppService> {

    @Override
    public RemoteYidaAppService create(Throwable throwable) {
        log.error("RemoteYidaAppService fallback reason:{}", throwable.getMessage());

        return new RemoteYidaAppService() {
            @Override
            public ResultBean<EduYidaApp> getAppBySchool(Long schoolId) {
                return null;
            }

            @Override
            public ResultBean<EduYidaApp> getAppBySchoolNoPermission(Long schoolId) {
                return null;
            }
        };
    }
}
