package com.ruoyi.other.api.factory; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.feignClient.GoodsClient; import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.openfeign.FallbackFactory; import java.util.List; /** * @author zhibing.pu * @Date 2024/11/27 19:57 */ @Slf4j public class GoodsClientFallbackFactory implements FallbackFactory { @Override public GoodsClient create(Throwable cause) { return new GoodsClient(){ @Override public R> getGoodsByType(Integer type) { return R.fail("根据类型(1=服务商品,2=单品商品)获取商品数据失败:" + cause.getMessage()); } @Override public R getGoodsById(Integer id) { return R.fail("根据id获取商品详情失败:" + cause.getMessage()); } @Override public R> getGoodsById(String [] ids) { return R.fail("根据ids获取商品详情失败:" + cause.getMessage()); } }; } }