|
|
@ -774,20 +774,22 @@ class Auth extends BaseController |
|
|
|
{ |
|
|
|
{ |
|
|
|
$userInfo = $this->request->userInfo(); |
|
|
|
$userInfo = $this->request->userInfo(); |
|
|
|
$users = userModel::getDB()->order("uid asc") |
|
|
|
$users = userModel::getDB()->order("uid asc") |
|
|
|
->field("uid,spread_uid as sid,spread_uid2 as tid,spread_count ") |
|
|
|
->field("uid,spread_uid as sid,spread_uid2 as tid,spread_count,pay_price") |
|
|
|
->select() |
|
|
|
->select() |
|
|
|
->toArray(); |
|
|
|
->toArray(); |
|
|
|
|
|
|
|
|
|
|
|
$data = userModel::getDB()->order("uid asc") |
|
|
|
$data = userModel::getDB()->order("uid asc") |
|
|
|
->field("uid,spread_uid as sid, spread_uid2 as tid") |
|
|
|
->field("uid,spread_uid as sid, spread_uid2 as tid,pay_price") |
|
|
|
->where("spread_uid", $userInfo->uid) |
|
|
|
->where("spread_uid", $userInfo->uid) |
|
|
|
->select() |
|
|
|
->select() |
|
|
|
->toArray(); |
|
|
|
->toArray(); |
|
|
|
foreach ($data as &$item ){ |
|
|
|
foreach ($data as &$item ){ |
|
|
|
$item['invites'] = $this->countSpInvites($users, $item['uid']); |
|
|
|
$item['invites'] = $this->countSpInvites($users, $item['uid']); |
|
|
|
$item['referrals'] = $this->countSpReferrals($users, $item['tid'], 'spread_count'); |
|
|
|
$item['referrals'] = $this->countSpReferrals($users, $item['uid'],'pay_price'); |
|
|
|
|
|
|
|
if($item['pay_price'] > 0){ |
|
|
|
|
|
|
|
$item['referrals'] += 1; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return app("json")->success($data); |
|
|
|
return app("json")->success($data); |
|
|
|
} |
|
|
|
} |
|
|
@ -812,6 +814,9 @@ class Auth extends BaseController |
|
|
|
$item['community_level'] = $level[$item['community_level']] ?? ''; |
|
|
|
$item['community_level'] = $level[$item['community_level']] ?? ''; |
|
|
|
$item['invites'] = $this->countSpInvites($users, $item['uid']); |
|
|
|
$item['invites'] = $this->countSpInvites($users, $item['uid']); |
|
|
|
$item['referrals'] = $this->countSpReferrals($users, $item['tid'], 'pay_price'); |
|
|
|
$item['referrals'] = $this->countSpReferrals($users, $item['tid'], 'pay_price'); |
|
|
|
|
|
|
|
if($item['pay_price'] > 0){ |
|
|
|
|
|
|
|
$item['referrals'] += 1; |
|
|
|
|
|
|
|
} |
|
|
|
$item['amount'] = $this->countSpReferrals($users, $item['tid'], 'spread_pay_price'); |
|
|
|
$item['amount'] = $this->countSpReferrals($users, $item['tid'], 'spread_pay_price'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -850,7 +855,6 @@ class Auth extends BaseController |
|
|
|
foreach ($nodes as $node) { |
|
|
|
foreach ($nodes as $node) { |
|
|
|
if ($node['sid'] == $parentId && $node[$field] > 0) { |
|
|
|
if ($node['sid'] == $parentId && $node[$field] > 0) { |
|
|
|
$count += 1; |
|
|
|
$count += 1; |
|
|
|
|
|
|
|
|
|
|
|
$count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited); |
|
|
|
$count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|