diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 449f669..1e54e05 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -774,21 +774,23 @@ class Auth extends BaseController { $userInfo = $this->request->userInfo(); $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() ->toArray(); $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) ->select() ->toArray(); - foreach ($data as &$item) { + foreach ($data as &$item ){ $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); } @@ -812,6 +814,9 @@ class Auth extends BaseController $item['community_level'] = $level[$item['community_level']] ?? ''; $item['invites'] = $this->countSpInvites($users, $item['uid']); $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'); } @@ -850,7 +855,6 @@ class Auth extends BaseController foreach ($nodes as $node) { if ($node['sid'] == $parentId && $node[$field] > 0) { $count += 1; - $count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited); } }