package com.ruoyi.other.api.factory; import com.ruoyi.account.api.dto.GiveVipDto; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.other.api.domain.TVip; import com.ruoyi.other.api.feignClient.VipClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.stereotype.Component; /** * 会员服务降级处理 * * @author ruoyi */ @Component public class VipFallbackFactory implements FallbackFactory { private static final Logger log = LoggerFactory.getLogger(VipFallbackFactory.class); @Override public VipClient create(Throwable throwable) { log.error("会员调用失败:{}", throwable.getMessage()); return new VipClient() { @Override public R getVipInfoByType(Integer type) { return R.fail("获取最高抵扣、最低起步价,最高折扣的会员失败:" + throwable.getMessage()); } @Override public R getInfo(Integer type) { return null; } @Override public R giveVip(GiveVipDto giveVipDto) { return R.fail("赠送会员:" + throwable.getMessage()); } @Override public R getInfo1(Integer id) { return R.fail("根据会员id 获取会员信息:" + throwable.getMessage()); } }; } }