puzhibing
2024-08-21 6b53b5915b10b0568bb5b44ee35679ece3c476ce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.ruoyi.account.api.factory;
 
import com.ruoyi.account.api.feignClient.AppUserVipDetailClient;
import com.ruoyi.account.api.model.TAppUserVipDetail;
import com.ruoyi.account.api.vo.GetAppUserVipDetail;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
 
/**
 *
 * @author ruoyi
 */
@Component
public class AppUserVipDetailFallbackFactory implements FallbackFactory<AppUserVipDetailClient>
{
    private static final Logger log = LoggerFactory.getLogger(AppUserVipDetailFallbackFactory.class);
 
    @Override
    public AppUserVipDetailClient create(Throwable throwable) {
        log.error("用户会员明细调用失败:{}", throwable.getMessage());
        return new AppUserVipDetailClient() {
    
            @Override
            public R<TAppUserVipDetail> getAppUserVipDetail(GetAppUserVipDetail getAppUserVipDetail) {
                return R.fail("获取用户当前有效的VIP明细调用失败:" + throwable.getMessage());
            }
        };
    }
}