jyc 3 months ago
parent
commit
1058a5c8a9

+ 3 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreCommentServiceImpl.java

@@ -577,6 +577,8 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
             }
             storeComment.setCreatedUserId(storeComment.getUserId());
 
+            int i = this.save(storeComment) ? 0 : 1;
+
             Map<String, String> commentCountAndScore = storeCommentMapper.getCommentCountAndScore(storeId);
             double total = StringUtils.isNotEmpty(commentCountAndScore.get("total")) ? Double.parseDouble(commentCountAndScore.get("total")) : 0;
             double scoreAvg = StringUtils.isNotEmpty(commentCountAndScore.get("score")) ? Double.parseDouble(commentCountAndScore.get("score")) / total : 0;
@@ -591,7 +593,7 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
             storeInfo.setServiceScore(serviceScore);
             storeInfoMapper.updateById(storeInfo);
 
-            return this.save(storeComment) ? 0 : 1;
+            return i;
         } catch (Exception e) {
             log.error("StoreCommentService.userComment ERROR Msg={}", e.getMessage());
             return 1;