From ebea8577924f691504bd7305679bb8c77f816d86 Mon Sep 17 00:00:00 2001 From: limu <610543851@qq.com> Date: Fri, 23 Feb 2024 19:55:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=93=81=E5=AE=A3=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/Auth.php | 6 +++++- app/controller/api/user/User.php | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 1e54e05..d67c9fc 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -775,6 +775,7 @@ 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,pay_price") + ->where('uid', '<>', $userInfo->uid) ->select() ->toArray(); @@ -813,7 +814,7 @@ class Auth extends BaseController foreach ($data as &$item) { $item['community_level'] = $level[$item['community_level']] ?? ''; $item['invites'] = $this->countSpInvites($users, $item['uid']); - $item['referrals'] = $this->countSpReferrals($users, $item['tid'], 'pay_price'); + $item['referrals'] = $this->countSpReferrals($users, $item['uid'], 'pay_price'); if($item['pay_price'] > 0){ $item['referrals'] += 1; } @@ -853,6 +854,9 @@ class Auth extends BaseController $visited[] = $parentId; // 将当前节点标记为已访问 foreach ($nodes as $node) { + if($node['uid'] == $parentId && $node[$field] > 0){ + $count += 1; + } if ($node['sid'] == $parentId && $node[$field] > 0) { $count += 1; $count += $this->countSpReferrals($nodes, $node['uid'], $field, $visited); diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index c1589ef..05f203e 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -414,6 +414,17 @@ class User extends BaseController $end = date('Y-m-d') . ' 23:59:59'; if($shareId > 0) { + //用户每天同type只能邀请10个人 多了就不加了 + $count = ValueContributionLog::getDB() + ->where('type', $type) + ->where('user_id', $shareId) + ->where('ctime', '>=', $start) + ->where('ctime', '<=', $end) + ->count(); + + if (!empty($count) && $count > 10) { + return app('json')->fail('达到上限'); + } //加100分 $userModel = userModel::getDB()->where('uid',$shareId)->find(); if ($userModel) {