devolp 3 rokov pred
rodič
commit
7839704fb5

+ 4 - 2
app/admin/logic/UserLogic.php

@@ -500,7 +500,7 @@ class UserLogic
     {
         $newUserPathArr[] = $pid;
 
-        $this->updatePidAndPathByPath($prefixPath);
+        $this->updatePidAndPathByPath($id, $prefixPath);
 
         $parentUser       = User::getUserById($pid);
         $newUserPathArr   = explode(',', $parentUser['path']);
@@ -537,13 +537,15 @@ class UserLogic
         return [false, null];
     }
 
-    private function updatePidAndPathByPath($prefixPath)
+    private function updatePidAndPathByPath($uid, $prefixPath)
     {
         $newTopUid = $prefixPath[count($prefixPath) - 1];
 
         // 从阶段处更新,分支出来作为第一层
         User::modifyUserPidAndPath($newTopUid, 0, '');
 
+        User::modifyUserPidAndPathByPid($uid, 0, '');
+
         $newUserPathArr = [];
         return $this->iteraMidifyPathByPid($newUserPathArr, $newTopUid);
 

+ 11 - 0
app/admin/model/dao/User.php

@@ -100,6 +100,17 @@ class User extends BaseDao
         Db::table(self::$table)->whereIn('id', $path)->inc('total_team_withdraw', $apply_money)->update();
     }
 
+    public static function modifyUserPidAndPathByPid($uid, int $pid, string $path)
+    {
+        return Db::table(self::$table)
+            ->where(['pid' => $uid])
+            ->update([
+                'pid'         => $pid,
+                'path'        => $path,
+                'update_time' => sr_getcurtime(time())
+            ]);
+    }
+
     public function getUserDetail($id)
     {
         return $this->model