Răsfoiți Sursa

直播分佣

kk 1 lună în urmă
părinte
comite
e1e57cbd31

+ 11 - 3
game-business/src/main/java/com/game/business/task/AppUserLiveDividedTask.java

@@ -58,8 +58,11 @@ public class AppUserLiveDividedTask {
 
             List<AppUserAgent> liveRateList = new ArrayList<>();
 
+            // 迭代次数记录
+            int num = 0;
+
             // 获取直播分成比例
-            getLiveRate(item.getUserId(), liveRateList);
+            getLiveRate(item.getUserId(), liveRateList, num);
 
             if(liveRateList.isEmpty()){
                 continue;
@@ -73,7 +76,7 @@ public class AppUserLiveDividedTask {
         }
     }
 
-    private void getLiveRate(Long userId, List<AppUserAgent> liveRateList){
+    private void getLiveRate(Long userId, List<AppUserAgent> liveRateList, int num){
 
         AppUserAgent userIdObject = new AppUserAgent();
         userIdObject.setUserId(userId);
@@ -89,7 +92,12 @@ public class AppUserLiveDividedTask {
         }
         liveRateList.add(userAgent);
 
-        getLiveRate(userAgent.getPid(), liveRateList);
+        // 只需要获取直属上级
+        if(num == 1){
+            return;
+        }
+        num ++;
+        getLiveRate(userAgent.getPid(), liveRateList, num);
 
     }