rabin 2 tahun lalu
induk
melakukan
971eadeac2
1 mengubah file dengan 5 tambahan dan 3 penghapusan
  1. 5 3
      lib/Relation.php

+ 5 - 3
lib/Relation.php

@@ -35,18 +35,20 @@ class Relation
     }
 
     # 更换上级 效率较高
-    public function replaceParent($uid, $old_parent, $new_parent)
+    public function replaceParent($uid, $old_parent, $new_parent, $call = true)
     {
         $info = Dever::db('invite/relation')->one(array('to_uid' => $uid, 'uid' => $old_parent));
         if ($info) {
             $state = Dever::db('invite/relation')->update(array('where_id' => $info['id'], 'uid' => $new_parent));
-            if ($state) {
+            if ($state && $call) {
                 $child = $this->getChild($uid, false, false);
                 if ($child) {
                     foreach ($child as $k => $v) {
-                        $this->replaceParent($v['to_uid'], $old_parent, $new_parent);
+                        $this->replaceParent($v['to_uid'], $old_parent, $new_parent, false);
                     }
                 }
+            } else {
+                Dever::alert('更新失败');
             }
         }
         return true;