wangyunpeng před 1 týdnem
rodič
revize
9852a16fdd

+ 5 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/UserManagementService.java

@@ -255,8 +255,13 @@ public class UserManagementService {
             }
         } else {
             int ugId = RandomUtils.nextInt(userGroupCountDTOList.size());
+            int i = 10;
             while (userGroupCountDTOList.get(ugId).getCount() >= gzhUserGroupPerCount) {
                 ugId = RandomUtils.nextInt(userGroupCountDTOList.size());
+                i--;
+                if (i <= 0) {
+                    break;
+                }
             }
             return ugId;
         }