chenchen 5 сар өмнө
parent
commit
70fca1a60d

+ 5 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/website/service/impl/BasicToWebServiceImpl.java

@@ -300,7 +300,11 @@ public class BasicToWebServiceImpl implements BasicToWebService
         tourUserLikeTravelNotes.setTravelNotesId(travelNotesId);
         tourUserLikeTravelNotes.setUserId(TokenData.takeFromRequest().getUserId());
         TourTourismProjectTravelNotes tourTourismProjectTravelNotes = tourTourismProjectTravelNotesService.getById(travelNotesId);
-        tourTourismProjectTravelNotes.setLikeCount(tourTourismProjectTravelNotes.getLikeCount()+1);
+        if(tourTourismProjectTravelNotes.getLikeCount() != null) {
+            tourTourismProjectTravelNotes.setLikeCount(tourTourismProjectTravelNotes.getLikeCount() + 1);
+        }else {
+            tourTourismProjectTravelNotes.setLikeCount(1);
+        }
         if(type == 0){
             tourUserLikeTravelNotesService.removeBy(tourUserLikeTravelNotes);
         }else {