|
@@ -13,8 +13,8 @@ class Relation
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- # 只记录3级关系
|
|
|
- private $total = 3;
|
|
|
+ # 只记录几级关系
|
|
|
+ private $total = 10;
|
|
|
|
|
|
# 通用的邀请方法:
|
|
|
# uid 当前用户的上级,需要通过code邀请码来得到
|
|
@@ -76,7 +76,7 @@ class Relation
|
|
|
# 清理邀请关系
|
|
|
public function dropParent($uid, $parent)
|
|
|
{
|
|
|
- return Dever::db($this->table)->delete(['to_uid' => $uid, 'uid' => $parent]);
|
|
|
+ return Dever::db($this->table)->delete(['uid' => $parent, 'to_uid' => $uid]);
|
|
|
}
|
|
|
|
|
|
# 获取某个用户的上级数据
|
|
@@ -122,9 +122,10 @@ class Relation
|
|
|
if ($end) {
|
|
|
$where['cdate##'] = ['<=', strtotime($end)];
|
|
|
}
|
|
|
- $method = 'select';
|
|
|
if ($method == 'count') {
|
|
|
$method = 'count';
|
|
|
+ } else {
|
|
|
+ $method = 'select';
|
|
|
}
|
|
|
return Dever::db($this->table)->$method($where);
|
|
|
}
|