|
@@ -34,6 +34,29 @@ class Relation
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ # 重置上级
|
|
|
+ public function resetParent($uid, $parent)
|
|
|
+ {
|
|
|
+ Dever::db('invite/relation')->delete(array('to_uid' => $uid));
|
|
|
+ $this->set($parent, $uid);
|
|
|
+
|
|
|
+ $child = $this->getChild($uid);
|
|
|
+ if ($child) {
|
|
|
+ foreach ($child as $k => $v) {
|
|
|
+
|
|
|
+ $child_parent = $this->getParentAll($v['uid']);
|
|
|
+ if ($child_parent) {
|
|
|
+ foreach ($child_parent as $k1 => $v1) {
|
|
|
+ if ($v1['level'] > $v['level']) {
|
|
|
+ Dever::db('invite/relation')->update(array('where_id' => $v['id'], 'uid' => $parent));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
# 清理邀请关系
|
|
|
public function dropParent($uid, $parent)
|
|
|
{
|