|
@@ -43,9 +43,9 @@ class Relation
|
|
|
# 更换上级
|
|
|
public function replaceParent($uid, $old_parent, $new_parent, $call = true)
|
|
|
{
|
|
|
- $info = Dever::db($this->table)->find(array('to_uid' => $uid, 'uid' => $old_parent));
|
|
|
+ $info = Dever::db($this->table)->find(['to_uid' => $uid, 'uid' => $old_parent]);
|
|
|
if ($info) {
|
|
|
- $state = Dever::db($this->table)->update($info['id'], array('uid' => $new_parent));
|
|
|
+ $state = Dever::db($this->table)->update($info['id'], ['uid' => $new_parent]);
|
|
|
if ($state && $call) {
|
|
|
$child = $this->getChild($uid, false, false);
|
|
|
if ($child) {
|
|
@@ -61,7 +61,7 @@ class Relation
|
|
|
# 重置上级
|
|
|
public function resetParent($uid, $parent)
|
|
|
{
|
|
|
- Dever::db($this->table)->delete(array('to_uid' => $uid));
|
|
|
+ Dever::db($this->table)->delete(['to_uid' => $uid]);
|
|
|
$this->set($parent, $uid);
|
|
|
|
|
|
$child = $this->getChild($uid, 1, false);
|
|
@@ -76,13 +76,13 @@ class Relation
|
|
|
# 清理邀请关系
|
|
|
public function dropParent($uid, $parent)
|
|
|
{
|
|
|
- return Dever::db($this->table)->delete(array('to_uid' => $uid, 'uid' => $parent));
|
|
|
+ return Dever::db($this->table)->delete(['to_uid' => $uid, 'uid' => $parent]);
|
|
|
}
|
|
|
|
|
|
# 获取某个用户的上级数据
|
|
|
public function getParent($uid, $level = 1)
|
|
|
{
|
|
|
- return Dever::db($this->table)->find(array('to_uid' => $uid, 'level' => $level));
|
|
|
+ return Dever::db($this->table)->find(['to_uid' => $uid, 'level' => $level]);
|
|
|
}
|
|
|
|
|
|
# 获取某个用户的所有上级数据
|
|
@@ -102,7 +102,7 @@ class Relation
|
|
|
if ($level) {
|
|
|
$where['level'] = $level;
|
|
|
}
|
|
|
- $set = array();
|
|
|
+ $set = [];
|
|
|
if ($page) {
|
|
|
$set['num'] = $page;
|
|
|
}
|