|
|
@@ -42,6 +42,9 @@ class TreeRecommend extends BaseModel
|
|
|
return [0, 1];//父节点,线路
|
|
|
}
|
|
|
$parent_last_point = self::where('uid', $spread_uid)->order('add_time', 'desc')->find();
|
|
|
+ if ($spread_uid == 0) {
|
|
|
+ $parent_last_point = self::order('add_time', 'asc')->find();
|
|
|
+ }
|
|
|
while (!$parent_last_point) {
|
|
|
$spread_uid = User::where('uid', $spread_uid)->value('spread_uid');
|
|
|
if (!$spread_uid)
|
|
|
@@ -49,18 +52,17 @@ class TreeRecommend extends BaseModel
|
|
|
else
|
|
|
$parent_last_point = self::where('uid', $spread_uid)->order('add_time', 'desc')->find();
|
|
|
}
|
|
|
- $parent_last_point = $parent_last_point['id'];
|
|
|
$way = 1;
|
|
|
while (1) {
|
|
|
//看线
|
|
|
$res = self::where('way', $way)->where('parent_id', $parent_last_point['id'])->find();
|
|
|
if ($res) {
|
|
|
for ($i = 0; ; $i++) {
|
|
|
- if ($i == 10) {
|
|
|
- $spreads = User::where('spread_uid', $parent_last_point['uid'])->column('uid');
|
|
|
- if (count(self::where('uid', 'in', $spreads)->group('uid')->field('uid,COUNT(uid)')->select()) >= $way) {
|
|
|
- break;
|
|
|
- }
|
|
|
+ if ($i == 11) {
|
|
|
+// $spreads = User::where('spread_uid', $parent_last_point['uid'])->column('uid');
|
|
|
+// if (count(self::where('uid', 'in', $spreads)->group('uid')->field('uid,COUNT(uid)')->select()) >= $way) {
|
|
|
+ break;
|
|
|
+// }
|
|
|
}
|
|
|
$id = $res['id'];
|
|
|
$res = self::where('way', 1)->where('parent_id', $id)->find();
|
|
|
@@ -124,10 +126,12 @@ class TreeRecommend extends BaseModel
|
|
|
{
|
|
|
$info = self::where('id', $point)->find();
|
|
|
$res = true;
|
|
|
- while ($info) {
|
|
|
+ $i = 0;
|
|
|
+ while ($info && $i < 12) {
|
|
|
$info->get += 130;
|
|
|
$res = $res && $info->save();
|
|
|
$info = self::where('id', $info['parent_id'])->find();
|
|
|
+ $i++;
|
|
|
}
|
|
|
return $res;
|
|
|
}
|