From d37ac1b495dd070e37209527bbedc1ce0730951a Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 01 一月 2025 15:16:41 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
index b1374df..8ff1004 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java
@@ -50,9 +50,11 @@
         List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).list();
         for (GoodsEvaluate goodsEvaluate : list) {
             AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
-            goodsEvaluate.setUserName(appUserById.getName());
-            goodsEvaluate.setAvatar(appUserById.getAvatar());
-            goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
+            if(null != appUserById){
+                goodsEvaluate.setUserName(appUserById.getName());
+                goodsEvaluate.setAvatar(appUserById.getAvatar());
+                goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
+            }
         }
         return R.ok(list);
     }
@@ -120,13 +122,12 @@
 
     private void buildDetail(GoodsEvaluate item) {
         AppUser appUser = appUserClient.getAppUserById(item.getAppUserId());
-        if (appUser == null){
-            throw new RuntimeException("获取用户信息失败");
+        if (appUser != null){
+            item.setPhone(appUser.getPhone());
+            item.setUserName(appUser.getName());
         }
         Goods goods = goodsService.getById(item.getGoodsId());
         item.setGoodsName(goods.getName());
-        item.setPhone(appUser.getPhone());
-        item.setUserName(appUser.getName());
     }
 
     /**

--
Gitblit v1.7.1