Pu Zhibing
2025-03-26 cbf2486983b77a27af9968bbb362cb8d43789115
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
package com.ruoyi.other.api.factory;
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.other.api.domain.CouponInfo;
import com.ruoyi.other.api.feignClient.CouponInfoClient;
import org.springframework.cloud.openfeign.FallbackFactory;
 
import java.util.List;
 
/**
 * @author zhibing.pu
 * @Date 2024/11/29 14:37
 */
public class CouponInfoClientFallbackFactory implements FallbackFactory<CouponInfoClient> {
    @Override
    public CouponInfoClient create(Throwable cause) {
        return new CouponInfoClient() {
            @Override
            public R<List<CouponInfo>> getCouponInfoList(List<Integer> ids) {
                return R.fail("根据id集合获取优惠券数据失败:" + cause.getMessage());
            }
 
            @Override
            public R<List<CouponInfo>> getCouponInfoByPersonType(Integer personType) {
                return R.fail("根据类型获取有效优惠券列表失败:" + cause.getMessage());
            }
        };
    }
}