luodangjia
2024-11-28 06f455915bb9d11caa8829942f9007809ee9ae3d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.ruoyi.other.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.feignClient.RemoteVipSettingClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
 
@Slf4j
public class RemoteVipSettingFallbackFactory implements FallbackFactory<RemoteVipSettingClient> {
    @Override
    public RemoteVipSettingClient create(Throwable cause) {
        return new RemoteVipSettingClient(){
            @Override
            public R<VipSetting> getVipSettingById(Integer id) {
                log.error("获取会员设置信息失败:{}", cause.getMessage());
                throw new ServiceException("获取会员设置信息失败");
            }
        };
    }
}