|
@@ -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;
|