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) {