From ad84b6e930b21b40166403f92dd492d5df27867f Mon Sep 17 00:00:00 2001 From: limu <610543851@qq.com> Date: Thu, 22 Feb 2024 20:08:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Auth.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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); } }