dever il y a 3 ans
Parent
commit
bf30076b6d
3 fichiers modifiés avec 15 ajouts et 1 suppressions
  1. 1 0
      database/relation.php
  2. 7 1
      lib/Relation.php
  3. 7 0
      src/Api.php

+ 1 - 0
database/relation.php

@@ -86,6 +86,7 @@ return array
 			),
 			'type' => 'all',
 			'order' => array('id' => 'desc'),
+			'page' => array(10, 'list'),
 			'col' => '*',
 		),
 

+ 7 - 1
lib/Relation.php

@@ -8,7 +8,7 @@ use Dever;
 class Relation
 {
 	# 只记录6级关系
-	private $total = 6;
+	private $total = 20;
 
     # 通用的邀请方法:
     # uid 当前用户的上级,需要通过code邀请码来得到
@@ -34,6 +34,12 @@ class Relation
         }
     }
 
+    # 清理邀请关系
+    public function dropParent($uid)
+    {
+        return Dever::db('invite/relation')->delete(array('to_uid' => $uid));
+    }
+
     # 获取某个用户的上级数据
     public function getParent($uid, $level = 1)
     {

+ 7 - 0
src/Api.php

@@ -58,6 +58,13 @@ class Api
 		return true;
 	}
 
+	# 删除邀请关系
+	public function dropRelation($uid)
+	{
+		$relation = new Relation();
+		return $relation->dropParent($uid);
+	}
+
 	# 获取某个用户的下级
 	public function getChild($uid, $level = false)
 	{