From b9522d131e168a92c88f23e2c0a3a2df079926b4 Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期一, 19 八月 2024 17:43:43 +0800
Subject: [PATCH] 新增加小程序接口

---
 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java
index f257843..2f57fab 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java
@@ -1,5 +1,7 @@
 package com.ruoyi.other.api.factory;
 
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.other.api.domain.TGoods;
 import com.ruoyi.other.api.feignClient.GoodsClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -7,20 +9,24 @@
 import org.springframework.stereotype.Component;
 
 /**
- * 商品服务降级处理
- * 
- * @author ruoyi
+ * @author zhibing.pu
+ * @Date 2024/8/16 13:48
  */
 @Component
-public class GoodsFallbackFactory implements FallbackFactory<GoodsClient>
-{
-    private static final Logger log = LoggerFactory.getLogger(GoodsFallbackFactory.class);
-
-    @Override
-    public GoodsClient create(Throwable throwable) {
-        log.error("商品调用失败:{}", throwable.getMessage());
-        return new GoodsClient() {
-        
-        };
-    }
+public class GoodsFallbackFactory implements FallbackFactory<GoodsClient> {
+	
+	private static final Logger log = LoggerFactory.getLogger(GoodsFallbackFactory.class);
+	
+	@Override
+	public GoodsClient create(Throwable throwable) {
+		log.error("商品调用失败:{}", throwable.getMessage());
+		return new GoodsClient() {
+			
+			@Override
+			public R<TGoods> getGoodsById(Integer id) {
+				return R.fail("根据id获取商品信息失败:" + throwable.getMessage());
+			}
+		};
+	}
+	
 }

--
Gitblit v1.7.1