licailing 4 жил өмнө
parent
commit
0c6b5d268e

+ 10 - 0
src/main/java/com/izouma/jiashanxia/service/OrderInfoService.java

@@ -416,6 +416,16 @@ public class OrderInfoService {
 
     }
 
+    public void distribution3(OrderInfo orderInfo) {
+        Long userId = orderInfo.getUserId();
+        User user = userRepo.findById(userId).orElseThrow(new BusinessException("无用户"));
+        // 不是普通用户
+        if (!Member.NORMAL.equals(user.getMember())) {
+            // 拿一级
+        }
+
+    }
+
     /*
     间推
      */

+ 6 - 2
src/main/java/com/izouma/jiashanxia/service/UserService.java

@@ -145,7 +145,11 @@ public class UserService {
                 if (ObjectUtil.isNotNull(parent)) {
 //                    if (this.getParent(parent, userInfo)) {
                     if (ObjectUtil.isNull(userInfo.getParent())) {
-                        userInfo.setParent(parent);
+                        User parentUser = userRepo.findById(parent).orElseThrow(new BusinessException("无上级"));
+                        // 上级不是普通会员
+                        if (!Member.NORMAL.equals(parentUser.getMember())){
+                            userInfo.setParent(parent);
+                        }
                     }
                     // 邀请成为黄金佳人 就改变上级为邀请者
                     if (expert && !userInfo.isVip()) {
@@ -518,7 +522,7 @@ public class UserService {
     身份升级
      */
     public void upgrade(Long parent) {
-        long num = userRepo.countByParentAndDelFalse(parent);
+        long num = userRepo.countByParentAndMemberAndDelFalse(parent,Member.EXPERT);
         // 成为钻石合伙人
         int upgradePartner = sysConfigService.getInt("UPGRADE_PARTNER");
         if (num > upgradePartner) {